中国高校课件下载中心 》 教学资源 》 大学文库

复旦大学:《离散数学 Discrete Mathematics(上)》英文课件(赵一鸣)16/30

文档信息
资源类别:文库
文档格式:PPT
文档页数:27
文件大小:1.05MB
团购合买:点击进入团购
内容简介
复旦大学:《离散数学 Discrete Mathematics(上)》英文课件(赵一鸣)16/30
刷新页面文档预览

5.4 Shortest-path problem Let G=(v,E, w) be a weighted connected simple graph, w is a function from edges set E to position real numbers set. We denoted the weighted of edge i, by w(i,j, and w(i,j)=+oo when JEE 4 Definition 21: Let the length of a path p in a weighted graph G=(V,E, w) be the sum of the weights of the edges of this path. We denoted by w(p). The distance between two vertices u and v is the length of a shortest path between u and v, we denoted by d(u, v). u=y min w(p)l pis a path between u and v, there is a path between u and v P

5.4 Shortest-path problem ❖ Let G=(V,E,w) be a weighted connected simple graph, w is a function from edges set E to position real numbers set. We denoted the weighted of edge {i,j} by w(i,j), and w(i,j)=+ when {i,j}E ❖ Definition 21: Let the length of a path p in a weighted graph G =(V,E,w) be the sum of the weights of the edges of this path. We denoted by w(p). The distance between two vertices u and v is the length of a shortest path between u and v, we denoted by d(u,v).     = = w p p is a path between u and v there is a path between u and v u v d u v p min { ( )| } 0 ( , )

今 Dijkstra’ s algorithm( E W.Dijkstra) .o Let G=(V,E, w) and VEn where W>0. Suppose that s is a nonempty subset of Vand y∈S.LetT=Vs Example: Suppose that (u. s a shortest path between u andv。 Then(u,v,v",v)is a L, shortest path between u and v

❖ Dijkstra’s algorithm (E.W.Dijkstra) ❖ Let G=(V,E,w) and |V|=n where w>0. Suppose that S is a nonempty subset of V and v1S. Let T=V-S. Example: Suppose that (u,v',v'',v''',v) is a shortest path between u and v. Then (u,v',v'',v''') is a shortest path between u and v

o Let VET. l(v be the length of a shortest path from vI to v containing only vertices in s

❖ Let vT. l(v) be the length of a shortest path from v1 to v containing only vertices in S

6 7 2 Example: S=a, bj, 3 5 2T={c,d,e,2 lc a-c: ac 4 a.b.c 3 l(c)=3。 (e)= be 6 令a,b,C,e4,l(e)=4?× Note: l(v) is the length of a shortest path from vI to v containing only vertices in S 令le)=6,l(d)=8 (2)=00

❖ l(e)=? ❖ a,b,e 6; ❖ a,b,c,e 4, l(e)=4?。 ❖ Note:l(v) is the length of a shortest path from v1 to v containing only vertices in S. ❖ l(e)=6, l(d)=8 ❖ l(z)=。 Example : S={a,b}, T={c,d,e,z} l(c): a→c:a,c 4 a,b,c 3, l(c)=3

令l(C)=3,l(e)=6,l(d)=8,l(z)=∞o o minverl(v=lc=3 is the length of a shortest path from a to c. 8 Theorem 5.12: Suppose that mineT l(v)) l(V). Then the length of the shortest path from v, to v'is /(v)

❖ l(c)=3,l(e)=6, l(d)=8, l(z)=。 ❖ minvT {l(v)}=l(c)=3 is the length of a shortest path from a to c. ❖ Theorem 5.12:Suppose that minvT {l(v)}= l(v'). Then the length of the shortest path from v1 to v' is l (v')

o Proof: Suppose that there is a path p from v, to and the length of this path less than l(v) Then the path p must conclude some vertices of Vi 路

❖ Proof: Suppose that there is a path p from v1 to v', and the length of this path less than l(v'). ❖ Then the path p must conclude some vertices of T-{v'}

令l(v)? 令(1)S={v1},T=V-{v1,forv∈T W,ν){,吟∈E l()= otherwise (2)For SCV, T=v-S, suppose that these vertices of the shortest paths from vi to any vertices of s are in S. By Theorem 5.12(minver(v)=lVR, VKET), we gained the result which I(vR is the length of the shortest path from v, to vk(distance)o The vertex v is added to s (Let S=SUlk, T=T-VR, VET. Suppose that /(v) is the length of a shortest path from v, to v containing only vertices in S. Then /'(v)=min(l(v), l(vk)+w(vRv) (4Let S=S,T=T,l(v=l(v), goto(2)

❖ l(v)? ❖ (1) S={v1 },T=V-{v1 },for vT (2)For SV, T=V-S, suppose that these vertices of the shortest paths from v1 to any vertices of S are in S. By Theorem 5.12(minvT{l(v)}=l(vk ), vkT), we gained the result which l(vk ) is the length of the shortest path from v1 to vk (distance)。The vertex vk is added to S. (3)Let S'=S∪{vk }, T'=T-{vk }, vT'. Suppose that l'(v) is the length of a shortest path from v1 to v containing only vertices in S'. Then l'(v)=min{l(v),l(vk )+w(vk ,v))} (4)Let S=S',T=T', l(v)=l'(v), goto (2)    +   = otherwise w v v v v E l v ( , ) { , } ( ) 1 1

7 5 6 S=a,b,=c,d, e, z 令l(c)=3,l(e)=6,l(d)=8,l(z)=+∞o 令 mInuet{(v)}=l(c)=3 s’={a,b,c},T={d,e, 6o e=min(e), l(c)+w(c, e)=4, oo l'(d=min l(d), l(c)+w(c, d)=8, w(c,d)=+∞ 令I(z)=min{(z),l(c)+w(C,2)}=+

❖ S={a,b},T={c,d,e,z} ❖ l(c)=3,l(e)=6, l(d)=8, l(z)=+。 ❖ minvT{l(v)}=l(c)=3 ❖ S’={a,b,c}, T’={d,e,z} ❖ l'(e)=min{ l(e), l(c)+w(c,e)}=4, ❖ l'(d)=min{l(d), l(c)+w(c,d)}=8, ❖ w(c,d)= + ❖ l'(z)=min{l(z), l(c)+w(c,z)}= +

令 Theoren513:Forv∈T,P(v)=min{v), +WVKs v)I 令 Proof:Lets=su{v o Suppose that /'(v) is the length of a shortest path from vI to v containing only vertices in S o(1There are some paths from vi to v, but these paths don't contain the vertex v, and other vertices of t. Then l(v) is the length of the shortest path of these paths, i.e. (v)=(v) 4s(2)There are some paths from v, to v, these paths from vI to Vk don't contain other vertices of T, and the vertex Vk adjacent edge vkv. Then l(v+w(vk,v) is the length of the shortest path of these paths, viz l'(v=l(vR+w vkv)

❖ Theorem 5.13: For vT‘, l’(v)= min{l(v), l(vk )+w(vk , v)} ❖ Proof: Let S'=S∪{vk }. ❖ Suppose that l‘(v) is the length of a shortest path from v1 to v containing only vertices in S’. ❖ (1)There are some paths from v1 to v, but these paths don’t contain the vertex vk and other vertices of T'. Then l(v) is the length of the shortest path of these paths, i.e. l'(v)=l(v)。 ❖ (2)There are some paths from v1 to v, these paths from v1 to vk don’t contain other vertices of T', and the vertex vk adjacent edge {vk ,v}. Then l(vk )+w(vk ,v) is the length of the shortest path of these paths, viz l'(v)= l(vk )+w(vk ,v)

冷(1)LetS=,T=V,l(v1)=0,forv≠v1and (v)=+o Let ke1 冷(2)S=S∪{vk},T=T-{vk}, . 8 For each vertex y of t 令(v=min{(v),v1)+w(v12v)}; 令()-(v),S->S,TT。 &3)minveTl(v=l(vk+u %(4)if k=n-1, then stop 4. if k<n-1, then k+l-k goto(2)

❖ (1)Let S=,T=V,l(v1 )=0,for vv1 and l(v)=+ ❖ Let k=1 ❖ (2)S'=S∪{vk },T'=T-{vk }, ❖ For each vertex v of T', ❖ l'(v)=min{l(v),l(vk )+w(vk ,v)}; ❖ l'(v)→l(v),S'→S,T'→T。 ❖ (3)minvT {l(v)}=l(vk+1 )。 ❖ (4)if k=n-1,then stop ❖ if k<n-1,then k+1→k goto (2)

共27页,试读已结束,阅读完整版请下载
刷新页面下载完整文档
VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
相关文档