Presentation is loading. Please wait.

Presentation is loading. Please wait.

5.3.2 Hamilton paths.

Similar presentations


Presentation on theme: "5.3.2 Hamilton paths."— Presentation transcript:

1 5.3.2 Hamilton paths

2 Definition 20: A Hamilton paths is a path that contains each vertex exactly once. A Hamilton circuit is a circuit that contains each vertex exactly once except for the first vertex, which is also the last.

3 Theorem 5.8: Suppose G(V,E) that has a Hamilton circuit, then for each nonempty proper subset S of V(G), the result which (G-S)≤|S| holds, where G-S is the subgraph of G by omitting all vertices of S from V(G). (G-S)=1,|S|=2 The graph G has not any Hamilton circuit, if there is a nonempty purely subgraph S of G so that (G-S)>|S|.

4 Omit {b,h,i} from V, (G-S)=4>3=|S|,The graph has not any Hamilton circuit

5 If (G-S)≤|S| for each nonempty proper subset S of G, then G has a Hamilton circuit or has not any Hamilton circuit. For example: Petersen graph

6 Proof: Let C be a Hamilton circuit of G(V,E)
Proof: Let C be a Hamilton circuit of G(V,E). Then (C-S)≤|S| for each nonempty proper subset S of V Why? Let us apply induction on the number of elements of S. |S|=1, The result holds Suppose that result holds for |S|=k. Let |S|=k+1 Let S=S'∪{v},then |S'|=k By the inductive hypothesis, (C-S')≤|S'| V(C-S)=V(G-S) Thus C-S is a spanning subgraph of G-S Therefore (G-S)≤(C-S)≤|S|

7 Theorem 5. 9: Let G be a simple graph with n vertices, where n>2
Theorem 5.9: Let G be a simple graph with n vertices, where n>2. G has a Hamilton circuit if for any two vertices u and v of G that are not adjacent, d(u)+d(v)≥n. n=8,d(u)=d(v)=3, u and v are not adjacent, d(u)+d(v)=6<8, But there is a Hamilton circuit in the graph. Note:1)if G has a Hamilton circuit , then G has a Hamilton path Hamilton circuit :v1,v2,v3,…vn,v1 Hamilton path:v1,v2,v3,…vn, 2)If G has a Hamilton path, then G has a Hamilton circuit or has not any Hamilton circuit

8 Corollary 1: Let G be a simple graph with n vertices, n>2
Corollary 1: Let G be a simple graph with n vertices, n>2. G has a Hamilton circuit if each vertex has degree greater than or equal to n/2. Proof: If any two vertices of G are adjacent ,then G has a Hamilton circuit v1,v2,v3,…vn,v1。 If G has two vertices u and v that are not adjacent, then d(u)+d(v)≥n. By the theorem 5.9, G has a Hamilton circuit. Kn has a Hamilton circuit where n≥3

9 Theorem 5. 10: Let the number of edges of G be m
Theorem 5.10: Let the number of edges of G be m. Then G has a Hamilton circuit if m≥(n2-3n+6)/2,where n is the number of vertices of G. Proof: If any two vertices of G are adjacent ,then G has a Hamilton circuit v1,v2,v3,…vn,v1. Suppose that u and v are any two vertices of G that are not adjacent. Let H be the graph produced by eliminating u and v from G. Thus H has n-2 vertices and m-d(u)-d(v) edges.

10 Theorem 5. 11:Let G be a simple graph with n vertices, n>2
Theorem 5. 11:Let G be a simple graph with n vertices, n>2. G has a Hamilton path if for any two vertices u and v of G that are not adjacent, d(u)+d(v)n-1.

11 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).

12 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'''.

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

14 l(e)=? a,b,e 6; a,b,c,e 4, l(e)=4?。
Example:S={a,b}, T={c,d,e,z} l(c): ac:a,c 4 a,b,c 3, l(c)=3。 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)=。

15 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').

16 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'}.

17 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)

18 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)}= +

19 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).

20 (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)。

21 Example:Find the length of a shortest path between a and z in the given weighted graph

22

23 The length of a shortest path between a and z is 13 and the path is (a,c,g,e,f,z)

24 NEXT :Trees Exercise P320 (Sixth) OR P306(Fifth) 3,4,5,6,18 2.Find the length of a shortest path between a and z in the given weighted graph.


Download ppt "5.3.2 Hamilton paths."

Similar presentations


Ads by Google