The Mathematics of Touring (Chapter...

39
The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler paths and Euler circuits: paths and circuits that use every edge of a graph. What if the goal is to visit every vertex instead of every edge?

Transcript of The Mathematics of Touring (Chapter...

Page 1: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

The Mathematics of Touring (Chapter 6)

In Chapter 5, we studied Euler paths and Euler circuits: pathsand circuits that use every edge of a graph.

What if the goal is to visit every vertex instead of every edge?

Page 2: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

The Traveling Salesman Problem (TSP)

Willy, a traveling salesman, has to visit each of several cities(say, the 48 state capitals of the continental United States)

He would like his trip to cover as little distance as possible.

In what order should Willy visit the 48 cities?

Page 3: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

The Traveling Salesman Problem (TSP)

The TSP comes up in many other contexts.

I A spacecraft needs to visit each of six sites on Mars tocollect samples (fuel is very expensive on Mars!)

I A school bus needs to visit each of several pickup/dropofflocations (here the issue is not money, but time)

I A mother is taking her four-year-old trick-or-treating andneeds to visit each of eight friends and relatives (studentin this class 10 years ago)

Page 4: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

The Traveling Salesman Problem (TSP)

The TSP comes up in many other contexts.

I A spacecraft needs to visit each of six sites on Mars tocollect samples (fuel is very expensive on Mars!)

I A school bus needs to visit each of several pickup/dropofflocations (here the issue is not money, but time)

I A mother is taking her four-year-old trick-or-treating andneeds to visit each of eight friends and relatives (studentin this class 10 years ago)

Page 5: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

The Traveling Salesman Problem (TSP)

The TSP comes up in many other contexts.

I A spacecraft needs to visit each of six sites on Mars tocollect samples (fuel is very expensive on Mars!)

I A school bus needs to visit each of several pickup/dropofflocations (here the issue is not money, but time)

I A mother is taking her four-year-old trick-or-treating andneeds to visit each of eight friends and relatives (studentin this class 10 years ago)

Page 6: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

The Traveling Salesman Problem (TSP)

The TSP comes up in many other contexts.

I A spacecraft needs to visit each of six sites on Mars tocollect samples (fuel is very expensive on Mars!)

I A school bus needs to visit each of several pickup/dropofflocations (here the issue is not money, but time)

I A mother is taking her four-year-old trick-or-treating andneeds to visit each of eight friends and relatives (studentin this class 10 years ago)

Page 7: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

The TSP As A Graph Problem

Suppose we have a graph in which every edge has a weight(representing its cost, time, or distance).

ED

CB

A

7 11

5

8 18

3

5

6

7

The TSP is then to find a path or a circuit thatI visits every vertex; andI has total weight as low as possible.

Page 8: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

A Hamilton path is a path that uses every vertex of agraph exactly once.

A Hamilton circuit is a circuit that uses every vertex of agraph exactly once.

I By contrast, an Euler path/circuit is a path/circuit thatuses every edge exactly once.

I Reminder: “Path” means that the starting and endingvertices are different; “circuit” means that they are thesame.

Page 9: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

A Hamilton path is a path that uses every vertex of agraph exactly once.

A Hamilton circuit is a circuit that uses every vertex of agraph exactly once.

I By contrast, an Euler path/circuit is a path/circuit thatuses every edge exactly once.

I Reminder: “Path” means that the starting and endingvertices are different; “circuit” means that they are thesame.

Page 10: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

A Hamilton path is a path that uses every vertex of agraph exactly once.

A Hamilton circuit is a circuit that uses every vertex of agraph exactly once.

I By contrast, an Euler path/circuit is a path/circuit thatuses every edge exactly once.

I Reminder: “Path” means that the starting and endingvertices are different; “circuit” means that they are thesame.

Page 11: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Page 12: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Start here....

Page 13: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Page 14: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Page 15: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Page 16: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Page 17: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Page 18: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Page 19: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Done!

Page 20: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Changing the starting vertex (or “reference vertex”) does notchange the Hamilton circuit, because the same edges aretraversed in the same directions.

Page 21: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Page 22: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Page 23: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

We can also make a Hamilton circuit into its “mirror image”by reversing direction. The mirror image uses the same edges,but backwards, so it is not considered the same as theoriginal Hamilton circuit.

Page 24: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton Paths and Hamilton Circuits

Page 25: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have both a Hamilton circuit and an Euler

circuit?

Page 26: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have both a Hamilton circuit and an Euler

circuit?

ED

CB

A

Page 27: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have both a Hamilton circuit and an Euler

circuit?

ED

CB

A

Page 28: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have both a Hamilton circuit and an Euler

circuit?

ED

CB

A

Page 29: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have a Hamilton circuit, but not an Euler circuit?

Page 30: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have a Hamilton circuit, but not an Euler circuit?

D

CB

A

Page 31: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have an Euler circuit, but not a Hamilton circuit?

Page 32: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have an Euler circuit, but not a Hamilton circuit?

ED

CB

A

Page 33: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have neither a Hamilton circuit nor an Eulercircuit? (To avoid silly answers, let’s just consider connectedgraphs.)

Page 34: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have neither a Hamilton circuit nor an Eulercircuit? (To avoid silly answers, let’s just consider connectedgraphs.)

Page 35: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have neither a Hamilton circuit nor an Eulercircuit? (To avoid silly answers, let’s just consider connectedgraphs.)

Page 36: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Can a graph have neither a Hamilton circuit nor an Eulercircuit? (To avoid silly answers, let’s just consider connectedgraphs.)

Page 37: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Hamilton vs. Euler

Conclusion: Whether a graph does or does not have aHamilton circuit tells you nothing about whether it has anEuler circuit, and vice versa.

The same is true for Hamilton/Euler paths (rather thancircuits).

Page 38: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Which Graphs Have Hamilton Circuits?

We know how to determine whether a graph has an Euler pathor circuit: count the odd vertices.

On the other hand, there is no simple way to tell whetheror not a given graph has a Hamilton path or circuit.

Page 39: The Mathematics of Touring (Chapter 6)people.ku.edu/~jlmartin/courses/math105-F11/Lectures/chapter6-part... · The Mathematics of Touring (Chapter 6) In Chapter 5, we studied Euler

Finding the Shortest Hamilton Circuit

Rather than asking whether a particular graph has a Hamiltoncircuit, we will be looking at graphs with lots of Hamiltoncircuits, and trying to find the shortest one.

For example, Willy the traveling salesman has the option todrive from any state capital to any other, so the graph he livesin has lots of edges.