120 likes | 1k Views
Traveling-Salesman Problem. Ch. 6. Hamilton Circuits. Euler circuit/path => Visit each edge once and only once Hamilton circuit => Visit each vertex once and only once (except at the end, where it returns to the starting vertex) Hamilton path => Visit each vertex once and only once
E N D
Hamilton Circuits • Euler circuit/path => Visit each edge once and only once • Hamilton circuit => Visit each vertex once and only once (except at the end, where it returns to the starting vertex) • Hamilton path => Visit each vertex once and only once • Difference: Edge (Euler) Vertex (Hamilton)
A B E D C Examples of Hamilton circuits • Has many Hamilton circuits: • A, B, C, D, E, A • A, D, C, E, B, A • Has many Hamilton paths: • A, B, C, D, E • A, D, C, E, B • Has no Euler circuit, no Euler path => 4 vertices of odd degree Graph 1 Hamilton circuits can be shortened into a Hamilton path by removal of the last edge
Examples of Hamilton circuits A B • Has no Hamilton circuits: • What ever the starting point, we are going to have to pass through vertex E more than once to close the circuit. • Has many Hamilton paths: • A, B, E, C, D • C, D, E, A, B • Has Euler circuit => each vertex has even degree E D C Graph 2
Examples of Hamilton circuits F A B • Has many Hamilton circuits: • A, F, B, E, C, G, D, A • A, F, B, C, G, D, E, A • Has many Hamilton paths: • A, F, B, E, C, G, D • A, F, B, C, G, D, E • Has Euler circuit => Every vertex has even degree E D C G Graph 3
Examples of Hamilton circuits G F Has no Hamilton circuits: Has no Hamilton paths: Has no Euler circuit Has no Euler path => more than 2 vertices of odd degree A B E D C I H Graph 4
A B D C Complete graph • A graph with N vertices in which every pair of vertices is joined by exactly one edge is called the complete graph. • Total no. of edges = N(N-1)/2 In K4, each vertex has degree 3 and the number of edges = 4 (3)/2 = 6
The six Hamilton circuits of K4 A B D C Rows => 6 Hamilton circuits Cols=> same Hamilton circuit with different reference points Graph Reference point A Reference point B Reference point C Reference point D
Complete graph • The number of Hamilton circuits in a complete graph can be computed by using factorials. • N! (factorial of N) = 1x 2x3x4x … x(N-1)x N • The complete graph with N vertices has (N-1)! Hamilton circuits. • Example: The complete graph with 5 vertices has 4! = 1x2x3x4 = 24 Hamilton circuits
Factorial Which of the following is true? n! = n! x (n-1)! n! = n! + (n-1)! n! = n x (n-1)! n! = n + (n-1)!
No. of edges No of edges in K10 is • 10 • 10! • 90 • 45
Complete graph In a complete graph with 14 vertices (A through N), the total number of Hamilton circuits (including mirror-image circuits) that start at vertex A is • 14! • (14x13)/2 • 15! • 13!