HAMILTON CIRCUITS

131
The Traveling-Salesman Problem

description

DISCRETE MATH UNIT 6. HAMILTON CIRCUITS. The Traveling-Salesman Problem. William Rowan Hamilton. Born August 4, 1805 in Dublin, Ireland Died September 2, 1865 in Dublin, Ireland Made many contributions to the Physics field including advancements in the study of optics and dynamics - PowerPoint PPT Presentation

Transcript of HAMILTON CIRCUITS

Page 1: HAMILTON CIRCUITS

The Traveling-Salesman Problem

Page 2: HAMILTON CIRCUITS

•Born August 4, 1805 in Dublin, Ireland

•Died September 2, 1865 in Dublin, Ireland

•Made many contributions to the Physics field including advancements in the study of optics and dynamics

•Introductions to the Mathematics Field•formed the study of quaternion•an extension of complex numbers that allows work in the 3rd and 4th dimensions (symbolized by a bold H)

•invented the Icosian Game (now called Hamilton’s Puzzle)•solved by using Icosian Calculus and these solutions developed into what are now called Hamilton Paths and Hamilton Circuits

Page 3: HAMILTON CIRCUITS

Hamilton Path: a path touching every vertex exactly onceevery edge does NOT have to be used

F

B

A C

D

A D E B C F

Hamilton Path Examples

D A B E G F

E B A D E G

G

C

F

NOT a Hamilton Path (Example)

C

E

G

Page 4: HAMILTON CIRCUITS

Hamilton Circuit: a circuit touching every vertex exactly onceevery edge does NOT have to be used

F

D

BA

C

EA D B C F E

Hamilton Circuit Examples

D A E F C B

E F D A B C

A

D

F

NOT a Hamilton Circuit (Example)

E

Page 5: HAMILTON CIRCUITS

Weight: a numerical value assigned to each edge of the graph

Total Weight: the sum of the edges’ weights used to complete the Hamilton Circuit or Path

Hamilton Circuit Examples

A

E

B

CD

23

5 11

3

8

6

9

A B C D E A

A E B C D A

Hamilton Path Examples

A B C D E

A E B C D

Page 6: HAMILTON CIRCUITS

Complete Graph: a graph with N vertices with edges connecting every pair of vertices

each vertex has a degree of (no loops)denoted by the symbol KN

vertices can be named in any order for Hamilton Circuits

1N

Formula for the Number of Hamilton Circuits: )!1( N

Complete Graph Examples

A

CB

A B

CD

A

E B

CD

A

G

C

D

B

F

H

EK3

2 HC’s

K4

6 HC’sK5

24 HC’sK8

5,040 HC’s

Page 7: HAMILTON CIRCUITS

Name originates from the classic problem of a traveling-salesman needing to find the cheapest circuit that will allow him to visit multiple clients by traveling to each city just 1 time.• the acronym TSP is used to identify this type of problem

TSPs are used to identify any type of problem that wants to find the cheapest route while touching every vertex exactly 1 time.

Other Examples of TSPs: Package Deliveries School Bus Routes Fabricating Circuit Boards Scheduling Jobs on a Machine Running Errands Around Town

Page 8: HAMILTON CIRCUITS

Brute-Force Algorithma) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

Nearest-Neighbor Algorithma) Pick a Starting Vertex.b) Travel to The Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

Repetitive Nearest-Neighbor Algorithma) Pick a Starting Vertex.b) Follow the Steps for the Nearest-Neighbor Algorithm (above).c) Repeat the process until EVERY vertex has become the starting/ending vertex.

Cheapest-Link Algorithma) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 9: HAMILTON CIRCUITS

Jerry is the Managing Partner of the “You’re Not Guilty” Law Firm. Part of managing one of the top law firms in the country is having to travel to all 5 of their major offices each month to meet with the partners. While Jerry lives in Dallas, he must visit Chicago, Los Angeles, Miami, and New York. Traveling obviously costs money and in order for clients not to feel like they are being overcharged, Jerry has to make sure that he travels to all 5 cities for as little as possible. We must find the most cost effective means for him to travel between these cities and end back home in Dallas. The cost of flights from each city is found on the following slides.

Los Angeles

Dallas

Chicago

Miami

New York

Page 10: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a

DALLAS n/a

LOS ANGELES

n/a

MIAMI n/a

NEW YORK

n/a

Page 11: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS n/a

LOS ANGELES

n/a

MIAMI n/a

NEW YORK

n/a

Page 12: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

n/a

MIAMI n/a

NEW YORK

n/a

Page 13: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI n/a

NEW YORK

n/a

Page 14: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

n/a

Page 15: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 16: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 17: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

Page 18: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,362

1

35

$952

$937$907

$787

$779

Brute-Force

Page 19: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

Page 20: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,687

13

4

5

$952

$937

$1,147

$787

$864

Brute-Force

Page 21: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

DAL–NY–MIA–LA–CHI–DAL = $952 + $937 + $864 + $787 + $1,147 = $4,687

Page 22: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,320

1

2

34

5

$952

$818

$907$864

$779

Brute-Force

Page 23: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

DAL–NY–MIA–LA–CHI–DAL = $952 + $937 + $864 + $787 + $1,147 = $4,687

DAL–NY–CHI–MIA–LA–DAL = $952 + $818 + $907 + $864 + $779 = $4,320

Page 24: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,220

1

25

4

$952

$818

$799

$787

$864

Brute-Force

Page 25: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

DAL–NY–MIA–LA–CHI–DAL = $952 + $937 + $864 + $787 + $1,147 = $4,687

DAL–NY–CHI–MIA–LA–DAL = $952 + $818 + $907 + $864 + $779 = $4,320

DAL–NY–CHI–LA–MIA–DAL = $952 + $818 + $787 + $864 + $799 = $4,220

Page 26: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,964

1

43

$952

$1,094

$907

$1,147

$864Brute-Force

Page 27: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

DAL–NY–MIA–LA–CHI–DAL = $952 + $937 + $864 + $787 + $1,147 = $4,687

DAL–NY–CHI–MIA–LA–DAL = $952 + $818 + $907 + $864 + $779 = $4,320

DAL–NY–CHI–LA–MIA–DAL = $952 + $818 + $787 + $864 + $799 = $4,220

DAL–NY–LA–MIA–CHI–DAL = $952 + $1,094 + $864 + $907 + $1,147 = $4,964

Page 28: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,539

1

4

5

3 $952

$1,094

$907

$799

$787

Brute-Force

Page 29: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

DAL–NY–MIA–LA–CHI–DAL = $952 + $937 + $864 + $787 + $1,147 = $4,687

DAL–NY–CHI–MIA–LA–DAL = $952 + $818 + $907 + $864 + $779 = $4,320

DAL–NY–CHI–LA–MIA–DAL = $952 + $818 + $787 + $864 + $799 = $4,220

DAL–NY–LA–MIA–CHI–DAL = $952 + $1,094 + $864 + $907 + $1,147 = $4,964

DAL–NY–LA–CHI–MIA–DAL = $952 + $1,094 + $787 + $907 + $799 = $4,539

Page 30: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,120

1

2

3

5

$799

$937

$818

$787

$779

Brute-Force

Page 31: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–MIA–NY–CHI–LA–DAL = $799 + $937 + $818 + $787 + $779 = $4,120

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

DAL–NY–MIA–LA–CHI–DAL = $952 + $937 + $864 + $787 + $1,147 = $4,687

DAL–NY–CHI–MIA–LA–DAL = $952 + $818 + $907 + $864 + $779 = $4,320

DAL–NY–CHI–LA–MIA–DAL = $952 + $818 + $787 + $864 + $799 = $4,220

DAL–NY–LA–MIA–CHI–DAL = $952 + $1,094 + $864 + $907 + $1,147 = $4,964

DAL–NY–LA–CHI–MIA–DAL = $952 + $1,094 + $787 + $907 + $799 = $4,539

Page 32: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,764

1

2

4

$799

$937

$1,094

$787

$1,147

Brute-Force

Page 33: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–MIA–NY–CHI–LA–DAL = $799 + $937 + $818 + $787 + $779 = $4,120

DAL–MIA–NY–LA–CHI–DAL = $799 + $937 + $1,094 + $787 + $1,147 = $4,764

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

DAL–NY–MIA–LA–CHI–DAL = $952 + $937 + $864 + $787 + $1,147 = $4,687

DAL–NY–CHI–MIA–LA–DAL = $952 + $818 + $907 + $864 + $779 = $4,320

DAL–NY–CHI–LA–MIA–DAL = $952 + $818 + $787 + $864 + $799 = $4,220

DAL–NY–LA–MIA–CHI–DAL = $952 + $1,094 + $864 + $907 + $1,147 = $4,964

DAL–NY–LA–CHI–MIA–DAL = $952 + $1,094 + $787 + $907 + $799 = $4,539

Page 34: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,397

1

3

2

45

$799

$818

$907

$1,094

$779

Brute-Force

Page 35: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–MIA–NY–CHI–LA–DAL = $799 + $937 + $818 + $787 + $779 = $4,120

DAL–MIA–NY–LA–CHI–DAL = $799 + $937 + $1,094 + $787 + $1,147 = $4,764

DAL–MIA–CHI–NY–LA–DAL = $799 + $907 + $818 + $1,094 + $779 = $4,397

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

DAL–NY–MIA–LA–CHI–DAL = $952 + $937 + $864 + $787 + $1,147 = $4,687

DAL–NY–CHI–MIA–LA–DAL = $952 + $818 + $907 + $864 + $779 = $4,320

DAL–NY–CHI–LA–MIA–DAL = $952 + $818 + $787 + $864 + $799 = $4,220

DAL–NY–LA–MIA–CHI–DAL = $952 + $1,094 + $864 + $907 + $1,147 = $4,964

DAL–NY–LA–CHI–MIA–DAL = $952 + $1,094 + $787 + $907 + $799 = $4,539

Page 36: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,722

1

2

4

3

$799

$1,147$864

$818

$1,094

Brute-Force

Page 37: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–MIA–NY–CHI–LA–DAL = $799 + $937 + $818 + $787 + $779 = $4,120

DAL–MIA–NY–LA–CHI–DAL = $799 + $937 + $1,094 + $787 + $1,147 = $4,764

DAL–MIA–CHI–NY–LA–DAL = $799 + $907 + $818 + $1,094 + $779 = $4,397

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

DAL–NY–MIA–LA–CHI–DAL = $952 + $937 + $864 + $787 + $1,147 = $4,687

DAL–NY–CHI–MIA–LA–DAL = $952 + $818 + $907 + $864 + $779 = $4,320

DAL–NY–CHI–LA–MIA–DAL = $952 + $818 + $787 + $864 + $799 = $4,220

DAL–NY–LA–MIA–CHI–DAL = $952 + $1,094 + $864 + $907 + $1,147 = $4,964

DAL–NY–LA–CHI–MIA–DAL = $952 + $1,094 + $787 + $907 + $799 = $4,539

DAL–MIA–LA–NY–CHI–DAL = $799 + $864 + $1,094 + $818 + $1,147 = $4,722

Page 38: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,545

1

2

4

5

$1,147

$937

$818

$864$779

Brute-Force

Page 39: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–MIA–NY–CHI–LA–DAL = $799 + $937 + $818 + $787 + $779 = $4,120

DAL–MIA–NY–LA–CHI–DAL = $799 + $937 + $1,094 + $787 + $1,147 = $4,764

DAL–MIA–CHI–NY–LA–DAL = $799 + $907 + $818 + $1,094 + $779 = $4,397

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

DAL–NY–MIA–LA–CHI–DAL = $952 + $937 + $864 + $787 + $1,147 = $4,687

DAL–NY–CHI–MIA–LA–DAL = $952 + $818 + $907 + $864 + $779 = $4,320

DAL–NY–CHI–LA–MIA–DAL = $952 + $818 + $787 + $864 + $799 = $4,220

DAL–NY–LA–MIA–CHI–DAL = $952 + $1,094 + $864 + $907 + $1,147 = $4,964

DAL–NY–LA–CHI–MIA–DAL = $952 + $1,094 + $787 + $907 + $799 = $4,539

DAL–CHI–NY–MIA–LA–DAL = $1,147 + $818 + $937 + $864 + $779 = $4,545

DAL–MIA–LA–NY–CHI–DAL = $799 + $864 + $1,094 + $818 + $1,147 = $4,722

Page 40: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,864

1

3

2

5

$1,147

$937

$907

$1,094

$779

Brute-Force

Page 41: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Make a list of ALL possible Hamilton Circuits.b) Calculate the Total Weight of EVERY Hamilton Circuit & Find the Cheapest One.

DAL–MIA–NY–CHI–LA–DAL = $799 + $937 + $818 + $787 + $779 = $4,120

DAL–MIA–NY–LA–CHI–DAL = $799 + $937 + $1,094 + $787 + $1,147 = $4,764

DAL–MIA–CHI–NY–LA–DAL = $799 + $907 + $818 + $1,094 + $779 = $4,397

DAL–NY–MIA–CHI–LA–DAL = $952 + $937 + $907 + $787 + $779 = $4,362

DAL–NY–MIA–LA–CHI–DAL = $952 + $937 + $864 + $787 + $1,147 = $4,687

DAL–NY–CHI–MIA–LA–DAL = $952 + $818 + $907 + $864 + $779 = $4,320

DAL–NY–CHI–LA–MIA–DAL = $952 + $818 + $787 + $864 + $799 = $4,220

DAL–NY–LA–MIA–CHI–DAL = $952 + $1,094 + $864 + $907 + $1,147 = $4,964

DAL–NY–LA–CHI–MIA–DAL = $952 + $1,094 + $787 + $907 + $799 = $4,539

DAL–CHI–NY–MIA–LA–DAL = $1,147 + $818 + $937 + $864 + $779 = $4,545

DAL–CHI–MIA–NY–LA–DAL = $1,147 + $907 + $937 + $1,094 + $779 = $4,864

DAL–MIA–LA–NY–CHI–DAL = $799 + $864 + $1,094 + $818 + $1,147 = $4,722

Page 42: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,120

1

2

3

5

$799

$937

$818

$787

$779

Since each circuit can be traveled in 2 directions, we only had to look at 12 circuits to cover all 24 possibilities.

This circuit can be traveled in either direction.

1

23

5

Page 43: HAMILTON CIRCUITS

Steps for the Nearest-Neighbor Algorithma) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.a) Once you get to the last vertex, connect it back to the starting vertex.

While the Brute-Force Algorithm will ALWAYS find the cheapest method, it is not very time friendly. The Nearest-Neighbor Algorithm is a method that allows you to find the “cheapest” circuit without having to analyze every possible circuit.

Page 44: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 45: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 46: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 47: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 48: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 49: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 787 $ 779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 50: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 787 $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 51: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES $ 787 $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 52: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 787 (2) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 53: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 907 $ 818

DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 787 (2) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 54: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 907 $ 818DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 787 (2) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 55: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 907 $ 818 (3)

DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 787 (2) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 56: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 907 $ 818 (3)

DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 787 (2) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 937

Page 57: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 907 $ 818 (3)

DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 787 (2) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK $ 937

Page 58: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 907 $ 818 (3)

DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 787 (2) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 937 (4)

Page 59: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 907 $ 818 (3)

DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 787 (2) $ 864 $ 1,094

MIAMI $799

NEW YORK

$ 937 (4)

Page 60: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Examplea) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 907 $ 818 (3)

DALLAS $ 1,147 $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 787 (2) $ 864 $ 1,094

MIAMI $799 (5)

NEW YORK

$ 937 (4)

Page 61: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,120

5

32

1

$799

$937

$818

$787

$779

Nearest-Neighbor

Page 62: HAMILTON CIRCUITS

Steps for the Repetitive Nearest-Neighbor Algorithma) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.d) Repeat the process until EVERY vertex has become the starting/ending vertex.

If Jerry applied the Nearest-Neighbor Algorithm to his flight plans, he would have been able to find the cheapest route without as much work. The question that follows is, “Why ever use the Brute-Force Method if the Nearest-Neighbor Algorithm works?”

Lets look at the same 5 City Example, but this time find out if the Nearest-Neighbor Algorithm works no matter what city Jerry lives in.

Page 63: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 64: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 65: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 66: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 67: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 68: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 69: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$779 $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 70: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES $779 $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 71: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$779 (2) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 72: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 799 $ 952

LOS ANGELES

$779 (2) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 73: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 799 $ 952

LOS ANGELES

$779 (2) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 74: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 799 (3) $ 952

LOS ANGELES

$779 (2) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 75: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 799 (3) $ 952

LOS ANGELES

$779 (2) $ 864 $ 1,094

MIAMI $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 76: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 799 (3) $ 952

LOS ANGELES

$779 (2) $ 864 $ 1,094

MIAMI $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 77: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 799 (3) $ 952

LOS ANGELES

$779 (2) $ 864 $ 1,094

MIAMI $ 937 (4)

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 78: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 799 (3) $ 952

LOS ANGELES

$779 (2) $ 864 $ 1,094

MIAMI $ 937 (4)

NEW YORK $ 818

Page 79: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Chicagoa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (1) $ 907 $ 818

DALLAS $ 799 (3) $ 952

LOS ANGELES

$779 (2) $ 864 $ 1,094

MIAMI $ 937 (4)

NEW YORK

$ 818 (5)

Page 80: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,120

3

4

5

2

$799

$937

$818

$787

$779

Nearest-Neighbor

Page 81: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Los Angelesa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 82: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Los Angelesa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 83: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Los Angelesa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 $ 799 $ 952

LOS ANGELES

$ 787 $779 (1) $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 84: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Los Angelesa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 $ 799 (2) $ 952

LOS ANGELES

$ 787 $779 (1) $ 864 $ 1,094

MIAMI $ 907 $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 85: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Los Angelesa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 818DALLAS $ 1,147 $ 799 (2) $ 952

LOS ANGELES

$ 787 $779 (1) $ 864 $ 1,094

MIAMI $ 907 (3) $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 86: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Los Angelesa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 818 (4)

DALLAS $ 1,147 $ 799 (2) $ 952

LOS ANGELES

$ 787 $779 (1) $ 864 $ 1,094

MIAMI $ 907 (3) $ 937

NEW YORK $ 1,094

Page 87: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Los Angelesa) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 818 (4)

DALLAS $ 1,147 $ 799 (2) $ 952

LOS ANGELES

$ 787 $779 (1) $ 864 $ 1,094

MIAMI $ 907 (3) $ 937

NEW YORK

$ 1,094 (5)

Page 88: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,397

23

4

51

$799

$907

$818

$1,094

$779

Nearest-Neighbor

Page 89: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Miamia) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 90: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Miamia) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 91: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Miamia) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 $ 779 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 (1) $ 864 $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 92: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Miamia) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 $ 779 (2) $ 952

LOS ANGELES $ 787 $ 1,094

MIAMI $ 907 $799 (1) $ 864 $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 93: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Miamia) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 818DALLAS $ 1,147 $ 779 (2) $ 952

LOS ANGELES

$ 787 (3) $ 1,094

MIAMI $ 907 $799 (1) $ 864 $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 94: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Miamia) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 818 (4)

DALLAS $ 1,147 $ 779 (2) $ 952

LOS ANGELES

$ 787 (3) $ 1,094

MIAMI $ 907 $799 (1) $ 864 $ 937

NEW YORK $ 937

Page 95: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: Miamia) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 818 (4)

DALLAS $ 1,147 $ 779 (2) $ 952

LOS ANGELES

$ 787 (3) $ 1,094

MIAMI $ 907 $799 (1) $ 864 $ 937

NEW YORK

$ 937 (5)

Page 96: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,120

1

43

2

$799

$937

$818

$787

$779

Nearest-Neighbor

Page 97: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: New Yorka) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Page 98: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: New Yorka) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK $ 818 $952 $ 1,094 $ 937

Page 99: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: New Yorka) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 $ 907

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 (1) $952 $ 1,094 $ 937

Page 100: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: New Yorka) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES $779 $ 864

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 (1) $952 $ 1,094 $ 937

Page 101: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: New Yorka) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907

DALLAS $ 799

LOS ANGELES

$779 (3) $ 864

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 (1) $952 $ 1,094 $ 937

Page 102: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: New Yorka) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907

DALLAS $ 799 (4)

LOS ANGELES

$779 (3) $ 864

MIAMI $ 937

NEW YORK

$ 818 (1) $952 $ 1,094 $ 937

Page 103: HAMILTON CIRCUITS

Steps for Solving the 5 Cities Example – Home: New Yorka) Pick a Starting Vertex.b) Travel to the Closest (Cheapest) Vertex. Repeat until ALL vertices are used 1 time.c) Once you get to the last vertex, connect it back to the starting vertex.

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907

DALLAS $ 799 (4)

LOS ANGELES

$779 (3) $ 864

MIAMI $ 937 (5)

NEW YORK

$ 818 (1) $952 $ 1,094 $ 937

Page 104: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,120

4

5

1

3

$799

$937

$818

$787

$779

Nearest-Neighbor

Page 105: HAMILTON CIRCUITS

Conclusion for the 5 Cities Example

HOME CITY COST OF CIRCUIT

Chicago $ 4,120

Dallas $ 4,120

Los Angeles $ 4,397

Miami $ 4,120

New York $ 4,120

This shows us that if Jerry lived in Los Angeles, it would not have been beneficial for him to trust the Nearest-Neighbor Algorithm. This does not mean he should not live in Los Angeles. It just shows that if using the Nearest-Neighbor Algorithm, you must check it from all the possible vertices to guarantee your answer is the cheapest.

Page 106: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO n/a $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 n/a $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 n/a $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 n/a $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937 n/a

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 107: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 1,147 $ 779 $ 799 $ 952

LOS ANGELES

$ 787 $779 $ 864 $ 1,094

MIAMI $ 907 $799 $ 864 $ 937

NEW YORK

$ 818 $952 $ 1,094 $ 937

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 108: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 779 $ 799 $ 952

LOS ANGELES

$ 864 $ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 109: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 779 $ 799 $ 952

LOS ANGELES

$ 864 $ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 110: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:

$779

Cheapest-Link

Page 111: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 864 $ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 112: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 $ 907 $ 818

DALLAS $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 864 $ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 113: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:

$779

Cheapest-Link

$787

Page 114: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907 $ 818

DALLAS $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 864 $ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 115: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907 $ 818

DALLAS $ 779 (1) $ 799 $ 952

LOS ANGELES

$ 864 $ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 116: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:

$779

Cheapest-Link

$787

$799

Page 117: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907 $ 818

DALLAS $ 779 (1) $ 799 (3) $ 952

LOS ANGELES

$ 864 $ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 118: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907 $ 818DALLAS $ 779 (1) $ 799 (3) $ 952

LOS ANGELES

$ 864 $ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 119: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:

$779

Cheapest-Link

$787

$799

$818

Page 120: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907 $ 818 (4)

DALLAS $ 779 (1) $ 799 (3) $ 952

LOS ANGELES

$ 864 $ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 121: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907 $ 818 (4)

DALLAS $ 779 (1) $ 799 (3) $ 952

LOS ANGELES $ 864 $ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 122: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:

$779

Cheapest-Link

$787

$799

$818

$864

Page 123: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907 $ 818 (4)

DALLAS $ 779 (1) $ 799 (3) $ 952

LOS ANGELES $ 864 $ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 124: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907 $ 818 (4)

DALLAS $ 779 (1) $ 799 (3) $ 952

LOS ANGELES

$ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 125: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907 $ 818 (4)

DALLAS $ 779 (1) $ 799 (3) $ 952

LOS ANGELES

$ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 126: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:

$779

Cheapest-Link

$787

$799

$818

$907

Page 127: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 907 $ 818 (4)

DALLAS $ 779 (1) $ 799 (3) $ 952

LOS ANGELES

$ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 128: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 818 (4)

DALLAS $ 779 (1) $ 799 (3) $ 952

LOS ANGELES

$ 1,094

MIAMI $ 937

NEW YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 129: HAMILTON CIRCUITS

CITIES CHICAGO DALLASLOS

ANGELESMIAMI

NEW YORK

CHICAGO $ 1,147 $ 787 (2) $ 818 (4)

DALLAS $ 779 (1) $ 799 (3) $ 952

LOS ANGELES

$ 1,094

MIAMI $ 937NEW

YORK

Steps for Solving the 5 Cities Examplea) Pick the edge with the smallest weight first. (if a tie, randomly choose one)b) Pick the next smallest edge. (make sure you mark each edge used – only use once)c) Repeat the process until EVERY vertex has been linked. (using each vertex once)d) Once every vertex has been used, link the last vertex back to the starting vertex.

Page 130: HAMILTON CIRCUITS

Los Angeles

Dallas

Chicago

Miami

New York

TOTAL COST:$ 4,120

$779

Cheapest-Link

$787

$799

$818

$937

Page 131: HAMILTON CIRCUITS

You Now Know All About