220 likes | 257 Views
Discrete mathematics. An Euler and Hamilton paths and circuits. N . V . Bilous. Faculty of computer sciences Software department, KNURE. KNURE, Software department, Ph. 7021-446, e-mail: belous@kture.kharkov.ua. The task of Königsberg bridge problem.
E N D
Discrete mathematics. An Euler and Hamilton paths and circuits N.V. Bilous Faculty of computer sciences Software department, KNURE KNURE, Software department, Ph. 7021-446, e-mail: belous@kture.kharkov.ua
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 5.Euler and Hamilton Circuits and Paths.
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 5.Euler and Hamilton Circuits and Paths.
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: V1, V2, V3, V4, V6, V5, V4, V2, V6, V1 The graph G does not have an Euler path. 5.Euler and Hamilton Circuits and Paths.
An Euler circuit. An Euler path f a c d a b g b e d c b a H3 H1 c H2 Example Which of the directed graphs have an Euler circuit? Of those that do not, which have an Euler path? The graph H2 has an Euler circuit a, g, c, b, g, e, d, f, a. Neither H1 nor H3 has an Euler circuit. H3 has an Euler path c, a, b, e, d, b, but H1 does not. d The Directed Graphs H1, H2, and H3 5.Euler and Hamilton Circuits and Paths.
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(V1)=2 deg(V4)=4 deg(V2)=4 deg(V5)=2 deg(V3)=2 deg(V6)=4 All vertices have even degrees, then G is Euler graph. 5.Euler and Hamilton Circuits and Paths.
Constructing Euler Circuits AlgorithmConstructing Euler Circuits. procedureEuler(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 whileH 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} 5.Euler and Hamilton Circuits and Paths.
Necessary and sufficient conditions for Euler Paths a b b g f c a e d d c 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? G1 contains exactly two vertices of odd degreeb and d. Hence it has an Euler path that must have b and d as its endpoints. G1 G2 5.Euler and Hamilton Circuits and Paths.
Necessary and sufficient conditions for Euler Paths a b b g f c a e d d c Continuation of an example One such Euler path is d, a, b, c, d, b. Similarly, G2 has no Euler path since it has six vertices of odd degree. G1 G2 5.Euler and Hamilton Circuits and Paths.
The puzzle of Mohammed's scimitars a j i e f b h g d c k Mohammed's scimitarscan be drawn with using Euler circuits and paths. In this way where the drawing begins and ends at the same point. 5.Euler and Hamilton Circuits and Paths.
A Hamilton path. A Hamilton circuit A path x0, x1,…, xn-1, xn in the graph G = (V, E) is called a Hamilton path if V = {x0, x1,…, xn-1,. xn} and xi≠ xj for 0 ≤ i<j ≤ n. A circuit x0 , x1 ,…, xn-1, xn, x0 (with n > 1) in a graph G = (V, E) is called a Hamilton circuit if x0, x1,…, xn-1, xn, x0, is a Hamilton path. 5.Euler and Hamilton Circuits and Paths.
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. 5.Euler and Hamilton Circuits and Paths.
A Hamilton graph a b e c d Graph in which existsHamilton 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 G1. b a b a g c e f d c d 5.Euler and Hamilton Circuits and Paths.
A Hamilton graph b a b a g a b e c c e f d c d d Continuation of an example There is no Hamilton circuit in G2, but G2 does have a Hamilton path a, b, c, d. G3 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. 5.Euler and Hamilton Circuits and Paths.
Necessary conditions for existence of Hamilton circuits Necessary conditions forexistence of Hamilton circuits: • The graph G should be connected. • For the graph G cuts and bridges are absent. 5.Euler and Hamilton Circuits and Paths.
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. 5.Euler and Hamilton Circuits and Paths.
Sufficient conditions for existence of Hamilton circuits Ore theorem. If in the graph G with n vertices (n3) the sum of degrees of any two verticesu, vis not smaller than n (deg u + deg vn), That the graph G is aHamilton graph. König theorem. In the complete directed graphG (which any pair vertices incorporates even in one direction) always exists Hamilton path . 5.Euler and Hamilton Circuits and Paths.
Roberts - Flores algorithm about Hamiltoncircuitspresence 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 5.Euler and Hamilton Circuits and Paths.
Roberts - Flores algorithm about Hamiltoncircuitspresence 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,с}. 5.Euler and Hamilton Circuits and Paths.
Roberts - Flores algorithm about Hamiltoncircuitspresence on the graph 3) From a column с, the first vertex a isnot 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 columnf there are no possible variants come back on one step. 5.Euler and Hamilton Circuits and Paths.
Roberts - Flores algorithm about Hamiltoncircuitspresence on the graph 5) In columnsd 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} 5.Euler and Hamilton Circuits and Paths.