§ 6.1-6.2 hamiltonian circuits and paths; complete graphs

35
§ 6.1-6.2 Hamiltonian § 6.1-6.2 Hamiltonian Circuits and Paths; Circuits and Paths; Complete Complete Graphs Graphs QuickTime™ and a H.263 decompressor are needed to see this picture. A sample-return mission A sample-return mission sent to discover signs of sent to discover signs of microbial life on Mars is microbial life on Mars is scheduled to be launched scheduled to be launched in 2014. in 2014. Once the un-manned rover Once the un-manned rover arrives, it will be arrives, it will be dispatched to several dispatched to several sites to collect samples sites to collect samples and run experiments. and run experiments. The rover will then The rover will then return to its landing site return to its landing site where a return rocket will where a return rocket will bring the samples to Earth. bring the samples to Earth.

Upload: tobias-richard

Post on 03-Jan-2016

50 views

Category:

Documents


0 download

DESCRIPTION

§ 6.1-6.2 Hamiltonian Circuits and Paths; Complete Graphs. A sample-return mission sent to discover signs of microbial life on Mars is scheduled to be launched in 2014. Once the un-manned rover arrives, it will be dispatched to several sites to collect samples and run experiments. - PowerPoint PPT Presentation

TRANSCRIPT

§ 6.1-6.2 Hamiltonian § 6.1-6.2 Hamiltonian Circuits and Paths; Circuits and Paths; Complete Complete GraphsGraphs

QuickTime™ and aH.263 decompressor

are needed to see this picture.

• A sample-return mission A sample-return mission sent to discover signs sent to discover signs of microbial life on of microbial life on Mars is scheduled to be Mars is scheduled to be launched in 2014. launched in 2014.

• Once the un-manned Once the un-manned rover arrives, it will rover arrives, it will be dispatched to several be dispatched to several sites to collect samples sites to collect samples and run experiments. and run experiments.

• The rover will then The rover will then return to its landing site return to its landing site where a return rocket will where a return rocket will bring the samples to Earth.bring the samples to Earth.

AB

C

G

F

E

D

• Suppose that the seven sites marked below Suppose that the seven sites marked below have been chosen as the most likely to bear have been chosen as the most likely to bear evidence of life. evidence of life.

• Assuming that the rover lands at Assuming that the rover lands at A A how might how might we route it?we route it?

AB

C

G

F

E

D

• Suppose that the seven sites marked below Suppose that the seven sites marked below have been chosen as the most likely to bear have been chosen as the most likely to bear evidence of life. evidence of life.

• Assuming that the rover lands at Assuming that the rover lands at A A how might how might we route it?we route it?

AB

C

G

F

E

D

• Suppose that the seven sites marked below Suppose that the seven sites marked below have been chosen as the most likely to bear have been chosen as the most likely to bear evidence of life. evidence of life.

• Assuming that the rover lands at Assuming that the rover lands at A A how might how might we route it?we route it?

AB

C

G

F

E

D

• Suppose that the seven sites marked below Suppose that the seven sites marked below have been chosen as the most likely to bear have been chosen as the most likely to bear evidence of life. evidence of life.

• Assuming that the rover lands at Assuming that the rover lands at A A how might how might we route it?we route it?

AB

C

G

F

E

D

• Suppose that the seven sites marked below Suppose that the seven sites marked below have been chosen as the most likely to bear have been chosen as the most likely to bear evidence of life. evidence of life.

• Assuming that the rover lands at Assuming that the rover lands at A A how might how might we route it?we route it?

AB

C

G

F

E

D

• Suppose that the seven sites marked below Suppose that the seven sites marked below have been chosen as the most likely to bear have been chosen as the most likely to bear evidence of life. evidence of life.

• Assuming that the rover lands at Assuming that the rover lands at A A how might how might we route it?we route it?

AB

C

G

F

E

D

• Suppose that the seven sites marked below Suppose that the seven sites marked below have been chosen as the most likely to bear have been chosen as the most likely to bear evidence of life. evidence of life.

• Assuming that the rover lands at Assuming that the rover lands at A A how might how might we route it?we route it?

AB

C

G

F

E

D

• Suppose that the seven sites marked below Suppose that the seven sites marked below have been chosen as the most likely to bear have been chosen as the most likely to bear evidence of life. evidence of life.

• Assuming that the rover lands at Assuming that the rover lands at A A how might how might we route it?we route it?

• This is just one of hundreds of possible This is just one of hundreds of possible routes the rover could take--the question we routes the rover could take--the question we will be concerned with is: will be concerned with is: Which route is the Which route is the best or most efficient?best or most efficient?

AB

C

G

F

E

D

• Suppose that the seven sites marked below Suppose that the seven sites marked below have been chosen as the most likely to bear have been chosen as the most likely to bear evidence of life. evidence of life.

• Assuming that the rover lands at Assuming that the rover lands at A A how might how might we route it?we route it?

• This is just one of hundreds of possible This is just one of hundreds of possible routes the rover could take--the question we routes the rover could take--the question we will be concerned with is: will be concerned with is: Which route is the Which route is the best or most efficient?best or most efficient?

• This is an example of what is called a This is an example of what is called a “Traveling-Salesman Problem” (or TSP).“Traveling-Salesman Problem” (or TSP).

Hamilton vs. EulerHamilton vs. Euler(Round 1: Fight!)(Round 1: Fight!)

• When dealing with Euler circuits or paths we were concerned with traversing each edge of a graph exactly one time.

• A circuit or path in which we visit each vertex once (and only once) is called a Hamiltonian circuit or path.

Example 1: (Exercise 3, pg 248) List all possible Hamiltonian circuits in the following graph:

Example 2: (Exercise 5, pg 248)

A B C

G F E

D

F

A

B C

D

GE

(a) Find a Hamiltonian path that begins at A and ends at E.

(b) Find a Hamiltonian circuit that starts at A and ends with the pair of vertices E, A.

(c) Find a Hamiltonian path that begins at F and ends at G.

Example 1: (Exercise 3, pg 248) List all possible Hamiltonian circuits in the following graph:

Example 2: (Exercise 5, pg 248)

A B C

G F E

D

F

A

B C

D

GE

(a) Find a Hamiltonian path that begins at A and ends at E.

(b) Find a Hamiltonian circuit that starts at A and ends with the pair of vertices E, A.

(c) Find a Hamiltonian path that begins at F and ends at G.

What about the Hamiltonian circuits that start at B, C, D, etc.?

Well, since such a circuit must pass through all of the vertices it doesn’t it doesn’t matter which vertex we start withmatter which vertex we start with..

Hamilton vs. EulerHamilton vs. Euler(Round 2: Fight!)(Round 2: Fight!)

• Just because a graph has an Euler circuit or path does not necessarily mean that it has a Hamiltonian circuit or path.

Hamilton vs. EulerHamilton vs. Euler(Round 2: Fight!)(Round 2: Fight!)

• Just because a graph has an Euler circuit or path does not necessarily mean that it has a Hamiltonian circuit or path.

• For instance, the following graph has an Euler circuit:

Hamilton vs. EulerHamilton vs. Euler(Round 2: Fight!)(Round 2: Fight!)

• Just because a graph has an Euler circuit or path does not necessarily mean that it has a Hamiltonian circuit or path.

• For instance, the following graph has an Euler circuit:

• However, it has no Hamiltonian circuit since you would have to travel through the middle vertex twice to return to your starting point.

Hamilton vs. EulerHamilton vs. Euler(Round 3: Fatality)(Round 3: Fatality)

• How can we tell whether or not a graph has a Hamiltonian circuit or path?

• Unfortunately, there is no easy criteria like there are for Euler circuits or paths.

• There are, however, some graphs such that every sequence of vertices gives us a Hamiltonian circuit.

Example 3: (Exercise 9, pg 249) The following graph has no Hamiltonian circuits or paths--why not?

F G

A B

E

D C

I H

Complete GraphsComplete Graphs

• A graph in which every pair of vertices is joined by exactly one edge is called a complete graph.

• If a complete graph has N vertices then we will name it KN.

• Complete graphs have tons of Hamiltonian circuits; we can write the vertices in any order, repeat the first vertex at the end and we will have a Hamiltonian circuit.

Complete GraphsComplete Graphs

K3

Complete GraphsComplete Graphs

K3 K4

Complete GraphsComplete Graphs

K3 K4 K5

K4

Example 4:

• How many edges does K4 have?

• What is the degree of each vertex?

• How many Hamiltonian circuits does it have?

A B

C D

K4

Example 4:

• How many edges does K4 have? Ans.: 6 = 12/2 = [(4)(3)]/2

• What is the degree of each vertex? Ans.: 3 = 4 - 1

• How many Hamiltonian circuits does it have?

A B

C D

1 A, B, C, D, A

Example 4:

• How many edges does K4 have? Ans.: 6 = 12/2 = [(4)(3)]/2

• What is the degree of each vertex? Ans.: 3 = 4 - 1

• How many Hamiltonian circuits does it have?1 A, B, C, D,

A

2 A, B, D, C, A

K4

A B

C D

Example 4:

• How many edges does K4 have? Ans.: 6 = 12/2 = [(4)(3)]/2

• What is the degree of each vertex? Ans.: 3 = 4 - 1

• How many Hamiltonian circuits does it have?1 A, B, C, D,

A

2 A, B, D, C, A

3 A, C, B, D, A

K4

A B

C D

Example 4:

• How many edges does K4 have? Ans.: 6 = 12/2 = [(4)(3)]/2

• What is the degree of each vertex? Ans.: 3 = 4 - 1

• How many Hamiltonian circuits does it have?1 A, B, C, D,

A

2 A, B, D, C, A

3 A, C, B, D, A

4 A, C, D, B, A

K4

A B

C D

Example 4:

• How many edges does K4 have? Ans.: 6 = 12/2 = [(4)(3)]/2

• What is the degree of each vertex? Ans.: 3 = 4 - 1

• How many Hamiltonian circuits does it have?1 A, B, C, D,

A

2 A, B, D, C, A

3 A, C, B, D, A

4 A, C, D, B, A

5 A, D, B, C, A

K4

A B

C D

Example 4:

• How many edges does K4 have? Ans.: 6 = 12/2 = [(4)(3)]/2

• What is the degree of each vertex? Ans.: 3 = 4 - 1

• How many Hamiltonian circuits does it have?

Ans.: 6 = (3)(2)(1) = (4 - 1)(4 - 2)(4 - 3)

1 A, B, C, D, A

2 A, B, D, C, A

3 A, C, B, D, A

4 A, C, D, B, A

5 A, D, B, C, A

6 A, D, C, B, A

K4

A B

C D

If we were to answer the same questions for K5 we would find the following:

If we were to answer the same questions for K5 we would find the following:

• Each vertex would have a degree of 5 - 1 = 4.

If we were to answer the same questions for K5 we would find the following:

• Each vertex would have a degree of 5 - 1 = 4.

• The graph would have [(5)(5 - 1)]/2 = [(5)(4)]/2 = 20 / 2 = 10 edges.

If we were to answer the same questions for K5 we would find the following:

• Each vertex would have a degree of 5 - 1 = 4.

• The graph would have [(5)(5 - 1)]/2 = [(5)(4)]/2 = 20 / 2 = 10 edges.

• There are (5 - 1) (5 - 2) ( 5 - 3) (5 - 4) = (4)(3)(2)(1)

= 24distinct Hamiltonian circuits.

Properties of Properties of KKNN

• The degree of each vertex in the complete graph with N vertices is N-1.

• The total number of edges is N(N-1)/2.

• The total number of distinct Hamiltonian circuits is(N - 1)! = (N - 1) x (N - 2) x (N - 3) x . . . x 3 x 2 x 1.

Example 5: (a) If KN has 720 distinct Hamiltonian circuits then what is N?

(b) If KN has 55 edges then what is N?

Example 6:(a) Given that 8! = 40,320 find 7! And 9!

(b) How many distinct Hamiltonian circuits are there in K10?