Top Banner
§ 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.
35

§ 6.1-6.2 Hamiltonian Circuits and Paths; Complete Graphs

Jan 03, 2016

Download

Documents

Tobias Richard

§ 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
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

§ 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.

Page 2: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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?

Page 3: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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?

Page 4: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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?

Page 5: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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?

Page 6: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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?

Page 7: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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?

Page 8: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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?

Page 9: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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?

Page 10: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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).

Page 11: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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.

Page 12: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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.

Page 13: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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..

Page 14: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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.

Page 15: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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:

Page 16: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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.

Page 17: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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.

Page 18: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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

Page 19: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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.

Page 20: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

Complete GraphsComplete Graphs

K3

Page 21: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

Complete GraphsComplete Graphs

K3 K4

Page 22: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

Complete GraphsComplete Graphs

K3 K4 K5

Page 23: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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

Page 24: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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

Page 25: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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

Page 26: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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

Page 27: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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

Page 28: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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

Page 29: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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

Page 30: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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

Page 31: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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.

Page 32: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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.

Page 33: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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.

Page 34: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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.

Page 35: § 6.1-6.2 Hamiltonian Circuits and Paths; Complete  Graphs

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?