Presentation is loading. Please wait.

Presentation is loading. Please wait.

KNURE, Software department, Ph. 7021-446, N.V. Bilous Faculty of computer sciences Software department, KNURE An Euler.

Similar presentations


Presentation on theme: "KNURE, Software department, Ph. 7021-446, N.V. Bilous Faculty of computer sciences Software department, KNURE An Euler."— Presentation transcript:

1 KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE An Euler and Hamilton paths and circuits Discrete mathematics.

2 N.V.Belous5.Euler and Hamilton Circuits and Paths. 2 The task of Königsberg bridge problem The Seven Bridges of Königsberg. Whether it is possible to start at some location in the town, travel across all the bridges without crossing any bridge twice, and return to the starting point. The Seven Bridges of Königsberg

3 N.V.Belous5.Euler and Hamilton Circuits and Paths. 3 The task of Königsberg bridge problem Euler studied this problem using the multigraph obtained when the four regions are represented by vertices and the bridges by edges. The question becomes: Is there a simple circuit in this multigraph that contains every edge. Multigraph Model of the Town of Königsberg

4 N.V.Belous5.Euler and Hamilton Circuits and Paths. 4 An Euler circuit. An Euler path An Euler circuit in a graph G is a simple circuit containing every edge of G. An Euler path in G is a simple path containing every edge of G. Example Have the undirected graph G an Euler circuit, an Euler path. The graph G has an Euler circuit: V 1, V 2, V 3, V 4, V 6, V 5, V 4, V 2, V 6, V 1 The graph G does not have an Euler path.

5 N.V.Belous5.Euler and Hamilton Circuits and Paths. 5 An Euler circuit. An Euler path Example Which of the directed graphs have an Euler circuit? Of those that do not, which have an Euler path? The graph H 2 has an Euler circuit a, g, c, b, g, e, d, f, a. Neither H 1 nor H 3 has an Euler circuit. H 3 has an Euler path c, a, b, e, d, b, but H 1 does not. d fa g H1H1 ba d c H2H2 b e c c b d H3H3 a The Directed Graphs H 1, H 2, and H 3

6 N.V.Belous5.Euler and Hamilton Circuits and Paths. 6 Necessary and sufficient conditions for Euler Circuit Euler Theorem. A connected multigraph has an Euler circuit if and only if each of its vertices has even degree. The graph, containing an Euler circuit is called an Euler graph. Example The graph G is connected. deg( V 1 )=2 deg( V 4 )=4 deg( V 2 )=4 deg( V 5 )=2 deg( V 3 )=2 deg( V 6 )=4 All vertices have even degrees, then G is Euler graph.

7 N.V.Belous5.Euler and Hamilton Circuits and Paths. 7 Constructing Euler Circuits Algorithm Constructing Euler Circuits. procedure Euler (G: connected multigraph with all vertices of even degree) circuit: = a circuit in G beginning at an arbitrarily chosen vertex with edges successively added to form a path that returns to this vertex H: = G with the edges of this circuit removed while H has edges begin subcircuit: = a circuit in H beginning at a vertex in H that also is an endpoint of an edge of circuit H: = H with edges of subcircuit and all isolated vertices removed circuit: = circuit with subcircuit inserted at the appropriate vertex end {circuit is an Euler circuit}

8 N.V.Belous5.Euler and Hamilton Circuits and Paths. 8 Necessary and sufficient conditions for Euler Paths A connected multigraph has an Euler path but not an Euler circuit if and only if it has exactly two vertices of odd degree. Example Which graphs have an Euler path? G 1 contains exactly two vertices of odd degree b and d. Hence it has an Euler path that must have b and d as its endpoints. d b a c a f b e c d g G1G1 G2G2

9 N.V.Belous5.Euler and Hamilton Circuits and Paths. 9 Necessary and sufficient conditions for Euler Paths Continuation of an example One such Euler path is d, a, b, c, d, b. Similarly, G 2 has no Euler path since it has six vertices of odd degree. d b a c a f b e c d g G1G1 G2G2

10 N.V.Belous5.Euler and Hamilton Circuits and Paths. 10 The puzzle of Mohammed's scimitars Mohammed's scimitars can be drawn with using Euler circuits and paths. In this way where the drawing begins and ends at the same point. a k g h j i f c b e d

11 N.V.Belous5.Euler and Hamilton Circuits and Paths. 11 A Hamilton path. A Hamilton circuit A path x 0, x 1,…, x n-1, x n in the graph G = (V, E) is called a Hamilton path if V = {x 0, x 1,…, x n-1,. x n } and x i ≠ x j for 0 ≤ i 1) in a graph G = (V, E) is called a Hamilton circuit if x 0, x 1,…, x n-1, x n, x 0, is a Hamilton path.

12 N.V.Belous5.Euler and Hamilton Circuits and Paths. 12 Hamilton’s puzzle Hamilton's puzzle consisted of a wooden dodecahedron (a polyhedron with 12 regular pentagons as faces). Is there a circuit in the graph that passes through each vertex exactly once? Hamilton's "Round the World" Puzzle.

13 N.V.Belous5.Euler and Hamilton Circuits and Paths. 13 A Hamilton graph Graph in which exists Hamilton circuit is called a Hamilton graph Example Which of the simple graphs have a Hamilton circuit or, if not, a Hamilton path? a, b, c, d, e, a is a Hamilton circuit in G 1. e a d a d c b f c b g a e c b d

14 N.V.Belous5.Euler and Hamilton Circuits and Paths. 14 A Hamilton graph Continuation of an example There is no Hamilton circuit in G 2, but G 2 does have a Hamilton path a, b, c, d. G 3 has neither a Hamilton circuit nor a Hamilton path since any path containing all vertices must contain one of the edges {a, b}, {e, f}, and {c, d} more than once. e a d a d c b a e c b d f c b g

15 N.V.Belous5.Euler and Hamilton Circuits and Paths. 15 Necessary conditions for existence of Hamilton circuits Necessary conditions for existence of Hamilton circuits: 1.The graph G should be connected. 2.For the graph G cuts and bridges are absent.

16 N.V.Belous5.Euler and Hamilton Circuits and Paths. 16 Sufficient conditions for existence of Hamilton circuits The theorem. If graph G is a connected simple graph with more then 2 vertices, then graph G has a Hamilton circuit if the degree of each vertex is at least n/2.

17 N.V.Belous5.Euler and Hamilton Circuits and Paths. 17 Sufficient conditions for existence of Hamilton circuits Ore theorem. If in the graph G with n vertices (n 3) the sum of degrees of any two vertices u, v is not smaller than n (deg u + deg v n), That the graph G is a Hamilton graph. König theorem. In the complete directed graph G (which any pair vertices incorporates even in one direction) always exists Hamilton path.

18 N.V.Belous5.Euler and Hamilton Circuits and Paths. 18 Roberts - Flores algorithm about Hamilton circuits presence on the graph Build a matrix M. Each columns corresponds to each vertex of the graph. Each elements of column specify vertex that incidence to initial vertex (for undirected graph) or is the end of arc that go out from initial vertex (for the directed graph). a b c d e f b c a c c a M = e d f d b c

19 N.V.Belous5.Euler and Hamilton Circuits and Paths. 19 Roberts - Flores algorithm about Hamilton circuits presence on the graph Begin with vertex a, assume that G´ ={а}. Then add vertices, using a matrix M as follows: 1) From a column a: get out every possible G´ = {а,b}. 2) From a column b: G´ = {а,b,с}.

20 N.V.Belous5.Euler and Hamilton Circuits and Paths. 20 Roberts - Flores algorithm about Hamilton circuits presence on the graph 3) From a column с, the first vertex a is not possible because it is already chosen earlier. Add the following vertex d. In a result, G´ = {a, b, c, d, f}. 4) From a column f : all vertices a, b, c exist in G. In column f there are no possible variants come back on one step.

21 N.V.Belous5.Euler and Hamilton Circuits and Paths. 21 Roberts - Flores algorithm about Hamilton circuits presence on the graph 5) In columns d and c also there are no vertices after f and d, means, again come back. G´ = {a,b}. 6) In column b add vertex е, then c,d,f. G´ 1 = {a,b,e,c,d,f} – Hamilton path. The arc (f, a) gives Hamilton circuit. G´ 2 = {a,b,e,d,f,c}


Download ppt "KNURE, Software department, Ph. 7021-446, N.V. Bilous Faculty of computer sciences Software department, KNURE An Euler."

Similar presentations


Ads by Google