Download presentation

Presentation is loading. Please wait.

Published byPrecious Peppin Modified over 2 years ago

1
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing

2
v Walks Walks v Paths and Circuits Paths and Circuits v Notation for Walks Notation for Walks v Connected Graphs Connected Graphs v Lemma Lemma v Euler Circuit Euler Circuit v Euler Path Euler Path v Connected Component Connected Component v Hamiltonian Circuit Hamiltonian Circuit Main Menu Main Menu (Click on the topics below)

3
Walks l A walk from a vertex u to v (in G) is a sequence of the form v 0 e 1 v 1 e 2 v 2 e 3……….. e k v k where u = v 0, v = v k and for any e i, endpoints(e i ) = {v i-1, v i } l Trivial walk from u to u consists of just u l Length of a walk: number of edges in the walk, where we count different appearance of an edge in the walk separately.

4
Walks v 1 e 2 v 2 e 3 v 3 e 3 v 2 is a walk from v 1 to v 2 with length 3. v1v1 v2v2 e2e2 e3e3 v3v3 e1e1 e4e4 v4v4 v5v5 e5e5 e6e6 e7e7 v6v6

5
Notation for Walks In graphs without parallel edges, we often omit the name of edges from the walk. This is so, since the edges are uniquely determined by the end points. Thus, we can reinsert the edges if needed.

6
END OF SEGMENT

7
Paths and Circuits l Path from u to v (in G) is a walk from u to v such that no edges are repeated. l A Simple Path from u to v (in G) is a path from u to v in which no vertices are repeated. l A closed walk is a walk which starts and ends at the same vertex. l A circuit is a closed walk in which no edges are repeated. l A simple circuit is a circuit in which no vertices (except for the last vertex, which is the same as first vertex) are repeated.

8
Paths and Circuits l v 1 e 2 v 2 e 3 v 3 e 3 v 2 is walk but not a path. l v 1 e 2 v 2 e 3 v 3 is a path from v 1 to v 3 l v 1 e 2 v 2 e 3 v 3 e 3 v 2 e 2 v 1 is a closed walk but not a circuit l v 1 e 2 v 2 e 3 v 3 e 1 v 1 is a simple circuit v1v1 v2v2 e2e2 e3e3 v3v3 e1e1 e4e4 v4v4 v5v5 e5e5 e6e6 e7e7 v6v6

9
END OF SEGMENT

10
Theorem Suppose G is a graph, u and v are vertices in V(G), and there is a walk from u to v (in G). Then there is a simple path from u to v in G.

11
Proof Since there is a walk from u to v, there must be a shortest walk from u to v. Let it be W = v 0 e 1 v 1 e 2... v i e i+1…… v j e j+1 ….. e k v k If it is a simple path, then we are done. Otherwise suppose v i = v j, i j. Then, W’ = v 0 e 1 v 1 e 2... v i e j+1 ….. e k v k v0v0 v i =v j vkvk is also a walk from u to v, with length smaller than W. A contradiction to W being of shortest length.. Thus W must be simple path.

12
END OF SEGMENT

13
Connected Graphs Two vertices u and v in a graph G, are connected iff there is a walk from u to v. G is connected iff all pair of vertices in G are connected.

14
Example v1v1 v2v2 e2e2 e3e3 v3v3 e1e1 e4e4

15
Example v1v1 v2v2 e2e2 e3e3 v3v3 e1e1 e4e4 v4v4 v5v5 e5e5 e6e6 e7e7 v6v6

16
END OF SEGMENT

17
Theorem Suppose G is a graph and C is a circuit in G containing vertices u, v. Suppose e is an edge in G. Let G’ be formed by deleting edge e from the graph G. Then there is still a path from u to v in G’.

18
Proof Suppose the circuit C in G is w…… u ……v ….. ……w e can be in only one of the above paths. So at least one path remains intact after removal of e. Thus, in G’, there is a path from u to v.

19
END OF SEGMENT

20
Lemma (a) If G is a connected graph, then any two distinct vertices of G can be connected by a simple path (b) If two distinct vertices v and w are part of a non-trivial circuit and one edge is removed from the circuit, then there still exists a path from v to w in the new graph so formed. (c) If G is connected and we remove an edge in a circuit, then G still remains connected.

21
END OF SEGMENT

22
Proof of Lemma (a) Suppose v, w are vertices in G. Then since G is connected, there exists a walk from u to v (in G). Therefore, by a theorem done earlier, there is a simple path from u to v. (a) If G is a connected graph, then any two distinct vertices of G can be connected by a simple path

23
END OF SEGMENT

24
Proof of Lemma (b) In earlier theorem we showed: Suppose G is a graph and C is a circuit in G containing vertices u and v. Suppose e is an edge in G. Let G’ be formed by deleting edge e from the graph G. Then there is still a path from u to v in G’. (b) If two distinct vertices v and w are part of a non-trivial circuit and one edge is removed from the circuit, then there still exists a path from v to w in the new graph so formed.

25
END OF SEGMENT

26
Proof of Lemma (c) (c) If G is connected and we remove an edge in a circuit, then G still remains connected.

27
Proof of Lemma (c) Suppose e is the edge in a circuit of G which is removed. Suppose e has endpoints u and v. Suppose G’ be the new graph. By part (b) there is a path, say P, from u to v in G’. To show: for all u’,v’ in V(G), there exists a walk from u’ to v’ in G’. Consider any u’, v’ in G. G is connected --> there is a walk and thus a path, say Q, from u’ to v’ in G. If Q doesn’t contain e: Q is a path from u’ to v’ in G’. If Q contains e: replace “uev” in Q by P and “veu” in Q by reverse of P. That is, if Q=u’……uev…..v’ then consider the walk u’……P…….v’ Note that this new walk is a walk in G’ from u’ to v’. Since u’, v’ were arbitrary element of V(G’), we get that G’ is connected.

28
END OF SEGMENT

29
Euler Circuit Suppose G is a graph. Euler circuit of G (in G) is a circuit which goes through all the edges (exactly once) and all the vertices of G. Note that the vertices may be repeated in an Euler circuit.

30
Euler Circuit - Example...... v0v0 v2v2 v4v4 v5v5 v3v3 v1v1 v 0 v 1 v 3 v 2 v 5 v 4 v 2 v 0 is an Euler circuit of the above graph

31
Euler Circuit - Example...... v0v0 v2v2 v4v4 v5v5 v3v3 v1v1

32
END OF SEGMENT

33
Theorem If a graph G has Euler circuit, then (a) G is connected, and (b) every vertex of G has even degree. Part (a): If G is not-connected then no circuit goes through all the vertices.

34
Proof (b) Suppose the Euler circuit is: v 0 e 1 v 1 e 2….. e i v i e i+1…… e j v j e j+1 ….. e k v 0 For any vertex v (except v 0 ): Coming in, going out occur in pairs. Each coming in and going out are via different edges (no repetition of edges in a circuit). Thus the degree of vertex v in G must be even. Similar reasoning holds for v 0 also, except that we consider the first exit and last entry separately.. come in, go out,.. ….. go out,.. come in,

35
END OF SEGMENT

36
Theorem If G is connected and every vertex of G has even degree, then G has an Euler circuit. Corollary: G has Euler circuit iff it is connected and every vertex of G has even degree.

37
Proof.v.v u.u. C (b) No edges left: Done. Or: we made a circuit C and v (in C) still has an edge unused in C. a) From u, walk until you are back at u (don’t repeat an edge). C’ c) From v build circuit C’ (using only unused edges). d) Insert C’ in C to form C’’ as follows: e) Let C =C’’, and go to step b). C’’ C: …… v…… ….. Then C’’: …..C’….. ….. (v is replaced by C’). C’’ uses all the edges in C and C’ exactly once..

38
END OF SEGMENT

39
Euler Path Suppose G is a graph. Let u and v be two distinct vertices of G. Then Euler path of G, from u to v, is a path from u to v which goes through all the edges of G (exactly once) and all the vertices of G.

40
Euler Path - Example...... v0v0 v2v2 v4v4 v5v5 v3v3 v1v1 v 2 v 0 v 1 v 3 v 5 v 4 v 2 v 3 is an Euler path from v 2 to v 3

41
Euler Path Corollary: Suppose G is a connected graph, and u, v are two distinct vertices in G. Then G has an Euler path from u to v, iff degree of u and v is odd, and the degree of all other vertices in G is even.

42
END OF SEGMENT

43
Connected Component A Graph H is a connected component of G iff a) H is a subgraph of G b) H is connected c) No connected subgraph H’ of G has H as its proper subgraph.

44
Connected Component v1v1 v2v2 e2e2 e3e3 v3v3 e1e1 e4e4 v4v4 v5v5 e5e5 e6e6 e7e7 v6v6

45
END OF SEGMENT

46
Hamiltonian Circuit A Hamiltonian Circuit of G is a simple circuit of G which goes through every vertex of G.

47
Hamiltonian Circuit - Example...... v0v0 v2v2 v4v4 v5v5 v3v3 v1v1 v 0 v 1 v 3 v 5 v 4 v 2 v 0 is an Hamiltonian circuit of the above graph

48
END OF SEGMENT

49
Hamiltonian Circuit - Theorem A non-empty graph G has Hamiltonian Circuit iff 1. G has only one vertex or 2. G has at least two vertices and G has a subgraph H such that a) H contains every vertex of G b) H is connected c) every vertex of H has degree 2 (note that this means H has same number of vertices as edges)

50
END OF SEGMENT

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google