180 likes | 855 Views
Euler circuit. Theorem 1 If a graph G has an Eulerian path, then it must have exactly two odd vertices. Theorem 2 If a graph G has an Eulerian circuit, then all of its vertices must be even vertices. Euler circuit. Hierholzer's algorithm : Create a circuit C 1 2 3 4 5 6 1
E N D
Euler circuit Theorem 1 If a graph G has an Eulerian path, then it must have exactly two odd vertices. Theorem 2 If a graph G has an Eulerian circuit, then all of its vertices must be even vertices.
Euler circuit Hierholzer's algorithm: Create a circuit C 1 2 3 4 5 6 1 Delete edges from the graph Find a vertex v C, v C1 and create new circuit 1 2 3 4 5 6 1 2 5 3 6 2
Hamiltonian Circuit If there is a vertex of degree one in a graph then it is impossible for it to have a Hamiltonian circuit. Dirac’s Theorem- “If G is a simple graph with n vertices where n>==3 such that the degree of every vertex in G is at least n/2, then G has a Hamiltonian circuit.” Ore’s Theorem- “If G is a simple graph with n vertices with n>=3 such that the sum of degrees for every pair of non-adjacent vertices is greater than n, then G has a Hamiltonian circuit.”
Hamiltonian Circuit The Brute force algorithm: 1. List all possible Hamiltonian circuits 2. Find the length of each circuit by adding the edge weights 3. Select the circuit with minimal total weight.
The Brute force algorithm Example: 13
Nearest Neighbor Algorithm (NNA) 1. Select a starting point. 2. Move to the nearest unvisited vertex (the edge with smallest weight). 3. Repeat until the circuit is complete. 13 ADCBA with a total weight of 1+8+13+4=26
Sorted Edges algorithm • AD • AC
Sorted Edges algorithm • AD • AC • BD
Sorted Edges algorithm • AD • AC • BD • BC