24
Chapter 6 Traveling Salesman Problem ESSENTIAL QUESTIONS: Section 6.1: How does Hamilton’s Circuits and Paths compare to Euler’s? Section 6.2: What is a complete graph? Section 6.3: What do the Traveling Salesman Problems (TSPs) use weighted graphs? Section 6.4: What are simple strategies for solving TSPs? Section 6.5: How does the Brute-Force and Nearest –Neighbor Algorithms solve TSPs? Section 6.6: What is an approximate algorithm? Section 6.7: How does the Repetitive Nearest – Neighbor Algorithm improve your ability to solve TSPs? Section 6.8: How does the Cheapest-Link Algorithm differ from the Nearest-Neighbor Algorithm? WORD WALL: Brute-Force Algorithm Cheapest-Link Algorithm Complete Graph Weight Hamilton Circuit Hamilton Path Inefficient Algorithm Nearest-Neighbor Algorithm Repetitive Nearest-Neighbor Algorithm Traveling Salesman Problem (TSP) Weighted Graph Extra Review/ Possible Homework: 6.1 = pp. 221 - 2 # 2, 4, 6, 7, 10, 11 6.2 = p 223 # 25 – 28 6.3 = pp. 222 – 3 # 13 – 16 6.4 /6.5 = pp. 223 – 225 # 29 - 31, 33, 35 6.7 = p. 225 #37 – 39, 41 6.8 = pp. 225 - 6 #43-45, 47

Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

Chapter 6 Traveling Salesman ProblemESSENTIAL QUESTIONS:Section 6.1: How does Hamilton’s Circuits and Paths compare to Euler’s? Section 6.2: What is a complete graph?Section 6.3: What do the Traveling Salesman Problems (TSPs) use weighted graphs?Section 6.4: What are simple strategies for solving TSPs?Section 6.5: How does the Brute-Force and Nearest –Neighbor Algorithms solve TSPs? Section 6.6: What is an approximate algorithm?Section 6.7: How does the Repetitive Nearest – Neighbor Algorithm improve your ability to solve TSPs?Section 6.8: How does the Cheapest-Link Algorithm differ from the Nearest-Neighbor Algorithm?

WORD WALL:Brute-Force AlgorithmCheapest-Link AlgorithmComplete GraphWeightHamilton CircuitHamilton PathInefficient AlgorithmNearest-Neighbor AlgorithmRepetitive Nearest-Neighbor AlgorithmTraveling Salesman Problem (TSP)Weighted Graph Extra Review/ Possible Homework: 6.1 = pp. 221 - 2 # 2, 4, 6, 7, 10, 11 6.2 = p 223 # 25 – 28 6.3 = pp. 222 – 3 # 13 – 166.4/6.5 = pp. 223 – 225 # 29 - 31, 33, 356.7 = p. 225 #37 – 39, 416.8 = pp. 225 - 6 #43-45, 47

Page 2: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

Section 6.1: Hamilton Circuits and Hamilton PathsEULER CIRCUITS AND PATHS HAMILTON CIRCUITS AND PATHS

• EULER = touch each EDGE of a graph exactly one time.

• By Definition : must touch every vertex “can touch more than once depending on degree”

• HAMILTON = Touch each VERTEX exactly one time (enter/ leave once).

• By Definition: Doesn’t require touching every edge

HAMILTON Circuits/Paths VERSUS EULER Circuits/PathsFor each of the following graphs, use our definitions of Hamilton and Euler to determine if circuits and paths of each type are possible.

Graph 1 Graph 2 Graph 3 Graph 4 Graph 5 Graph 6EULER PATH

NO YES NO NO YES NO

EULER CIRCUIT

YES NO NO YES NO NO

HAMILTON PATH

YES YES YES YES NO YES

HAMILTON CIRCUIT

YES NO YES NO NO NO

What do you notice about the relationship between a graph having an Euler Circuit or Path and having a Hamilton Circuit of path?There is no relationship

IN GENERAL, THERE ARE NO THEOREMS TO DETERMINE IF A GRAPH HAS A HAMILTON PATH OR CIRCUIT.

HELPFUL HINT: #1: FOR HAMILTON CIRCUITS/ PATHS, VERTICES OF DEGREE 1 OR 2 ARE VERY HELPFUL BECAUSE THEY REPRESENT REQUIRED EDGES TO REACH THAT VERTEX.

#2: EXAMPLE: Hamilton Circuit = A, B, C, D, A SHIFT/SAME Hamilton Circuits:

Follows the SAME rotation order for a circuit, but with a different start.

DISTINCT Hamilton Circuits:A different order of vertices (Left to Right) from the same starting vertex. (reverse order counts)

B, C, D, A, BC, D, A, B, CD, A, B, C, D

A, D, C, B, A (reverse order)A, D, B, C, A AND reverse = A, C, B, D, A A, B, D, C, A AND reverse = A, C, D, B, A

A B

CD

Page 3: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

EXAMPLE #1: List all possible Hamiltonian circuits in the following graph1. A, B, C, D, E, F, G, A2. A, B, E, D, C, F, G, A3. A, F, C, D, C, B, G, A4. A, F, E, D, C, B, G, AREVERSE EACH ONE OF THESE 4 CIRCUITS

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 matter which vertex we start with.Related to the idea of shifts of circuits.

EXAMPLE #2: (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.

(a) A, F, B, C, G, D, E(b) A, F, B, C, G, D, E, A(c) F, B, C, E, A, D, G

F, A, E, B, C, D, G

Example 3: The following graph has no Hamiltonian circuits or paths--why not? 4 bridges exist = can’t have a circuit; No path possible because multiple vertices of degree 1

EXAMPLE #4: (a) Find all Hamiltonian circuits that starts at A.(b) Find all Hamiltonian circuits that starts at D.(c) Explain why your answers in a and b must have the same

number of circuits. (a)A, C, F, D, E, B, A

A, D, F, E, B, C, AA, D, E, F, C, B, A (REVERSE ORDER as well)

(b) Re-order answers in part a(c)Re-ordering concept

HOMEWORK: pp. 221 - 222 # 2, 4, 6, 7, 10, 11

A B C

D

F EG

F

A

B C

D

GE

A

BC

D

EF

Page 4: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass
Page 5: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

Section 6.2: Complete GraphsEXAMPLE PUT 6 OR 8 DOTS ON WHITEBOARD AND START CONNECTING THEM AND ASK STUDENTS TO DESCRIBE HOW I AM MAKING THE GRAPH: “ONE DOT IS CONNECTED TO EVERY OTHER DOT” TO START DEFINITION

COMPLETE GRAPH: A graph in which every pair of distinct vertices is joined by exactly one edge. o Notation: KN = a complete graph of N vertices

EXAMPLES OF COMPLETE GRAPHS for 3, 4, and 5 vertices:

Use the definition of a complete graph to answer the following questions:

K3 K4 K5

Page 6: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

1. Does a complete graph have to be connected?YES; “every pair of vertices connected by an edge”

2. Is a complete graph allowed to have loops?NO; “Distinct (Different) Vertices only”

3. Is a complete graph allowed to have multiple edges?NO; exactly “one edge”

4. Can different vertices have different degree? NO; each vertex must be connected all remaining vertices

Page 7: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

What is the DEGREE of each VERTEX for N vertices? K3: Degree = 2K4: Degree = 3K5: Degree = 41 Less than the # of vertices

Degree = N - 1

How many EDGES are in KN (complete graph of N vertices)?

Page 8: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

EDGES TOTAL DEGREEK3: EDGES = 3 6 = 3*2

K4: EDGES = 6 12 = 4*3

K5: EDGES = 10 20 = 5*4

K6: EDGES = 15 30 = 6*5

What is the relationship between edges and degrees? Euler’s Sum of Degree Theorem:(total # of degrees) = 2 * (# of edges)N(N-1) = 2 * (# of edges)

number of edges in KN

Page 9: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

Where have you seen this formula before? Chapter 1: the number of pairwise comparisons.

DEGREE and VERTICES are consecutive numbers.

SUMMARY OF COMPLETE GRAPH INFORMATIONComplete Graph Number of Vertices Degree of Each Vertex Number of Edges

KN N N – 1Connected Graph, No Loops, No Multiple Edges

K3= Complete Graph of 4 Vertices K4 = Complete Graph of 4 Vertices1) How many Hamiltonian circuits does it have?2

1) How many Hamiltonian circuits does it have?6

If we were to answer the same questions for K5 we would find the following:1) How many Hamiltonian circuits does it have?

(Do you notice any possible relation in how we answered this question for K3 and K4 that might help you here?)

(5 - 1) (5 - 2) ( 5 - 3) (5 - 4) = (4)(3)(2)(1) = 24 (see page 202 for exact circuits)

How many DISTINCT HAMILTON CIRCUITS are in KN?Complete Graph Vertices Hamilton CircuitsK3: 3 2K4: 4 6K5: 5 24K6: 6 120

(N – 1)! = (Degree) != Distinct Hamilton Circuits in KN.

Calculator Command Reminder: [MATH] – [PRB] – [4:!]

K4

A B

C D

1 A, B, C, D, A2 A, B, D, C, A3 A, C, B, D, A4 A, C, D, B, A5 A, D, B, C, A6 A, D, C, B, AK3

A

B C

1 A, B, C, A

2 A, C, B, A

Page 10: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

INDEPENDENT PRACTICE: Apply the Properties of Complete Graphs(1)How many edges are there in K20? 20(19)/2 = 190 edges

(2)How many distinct Hamilton Circuits exist in K10? (10 – 1)! = 9! = 362880

(3)How many vertices are in the K50 graph? N = 50

(4)What is the degree of every vertex in K200? Degree = 200-1 = 199

(5)How many distinct Hamilton Circuits exist in K22? (22 – 1)! = 21! Or 5.109094217E19

(6)How many edges are there in K32? Edges = (32)(32 – 1)/2 = 496 edges

(7)What is the degree of every vertex in K15? Degree = 15 – 1 = 14

(8) If KN has 120 distinct Hamiltonian circuits then what is N?N = 6

Trial and Error: Divide 120 by consecutive numbers starting with 2Add one to last number used = Number of vertices

(9) If KN has 55 edges then what is N?N = 1155 = (N)(N-1)/2; HINT: square root trick of DOUBLE EDGES round up = N and round down = N -1

(10) If the number of edges of K12 is x and the number of edges of K13 is y, what is the values of y - x?(13)(12)/2 - (12)(11)/ 2 = (12/2) (13-11) = 12

(11) For each of the following cases find the value of N.a. KN has 5040 distinct Hamilton Circuits. 5040 = 7!; N = 7 + 1 = 8

Page 11: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

b. KN has 66 edges. 66 = 12*11/2; N = 12

c. KN has 80,200 edges. 80,200 = 401*400/2; N = 401

(12) If KN has 362,880 distinct Hamilton Circuits, then… 362,880 = 6!; N = 7a. How many vertices are in the KN graph? 7 VERTICES

b. What is the degree of each vertex are in the KN graph? 7 -1 = 6

c. How many edges are in the KN graph?7*6/2 = 21 edges

Page 12: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

Section 6.3: Traveling Salesman Problems WEIGHTED GRAPH: Any graph whose edges have numbers associated or assigned to them

(NOT DRAWN TO SCALE ALWAYS)

o Weights: number for each edge

o Examples of Weights : distance, time, cost…

Complete Weighted Graph: Complete graph that has weights associated with it

TRAVELING SALESMAN PROBLEMS:From home, the traveling salesman must visit different destinations to sell goods and return home. This is essentially finding a Hamilton Circuit. GOAL: Try to find the cheapest, most efficient, optimal route that is a Hamilton circuit for a given graph (find the least total weight)

Example – The Simpsons: Homer Simpson he has to run errands at the Kwik-E-Mart, the Retirement Home and Moe`s. Assuming that he wants to begin and end his day at home find the route that will allow him to get back to napping as soon as possible.

The numbers will represent the number of blocks between each destination.

When we place values like this on the edges of a graph we refer to them as the weights of the edges.

What if Homer preferred going to see Grandpa first to get it out of the way?A – B – C – D – A A-B-D-C- A12 + 20 + 17 + 8 = 57 BLOCKS 12+15+17+20 = 64 BLOCKS

What if Homer preferred going to the KWIK-E-MART last?A-B-D-C- A A – D – B – C – A 12+15+17+20 = 64 BLOCKS 8 +15 + 20 + 20 = 63 BLOCKS

Traveling Salesman Problem Steps:(1) Create graph models(2) Apply weights to these models(3) Find optimal Hamilton Circuits. (Not Always a practical statement)

REAL-LIFE EXAMPLES: 1) Routing School Buses 2) Package Deliveries: UPS or FedEx Delivery Truck3) Running Errands around Town 4) Planning a road trip5) Grocery Shopping: Planning which aisles you need to go down

HOMEWORK: pp. 222 – 223 # 13 – 16

12

8

20

171520

A

BC

D

Page 13: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

Section 6.4 and 6.5: Simple Algorithms for Solving Traveling Salesman Problems

Strategy #1: BRUTE FORCE (Exhaustive Search)

BRUTE-FORCE ALGORITHMStep 1: Make a list of ALL distinct Hamilton circuits of the graph from ONE starting vertex

Step 2: Calculate its TOTAL WEIGHT for each circuit.

Step 3: Choose an OPTIMAL circuit. (There is always more than one optimal circuit because of mirror-images)

PRO: Guarantee Optimal Hamilton Circuit

CON: INEFFICIENT ALGORITHM# steps needed to carry out algorithm grows disproportionately with the size of population (vertices)ie TAKES A LOT OF TIME the more vertices/ edges there are

STRATEGY #2: NEAREST – NEIGHBOR ALGORITHMFrom the start vertex, go to the vertex that is the shortest to get to. From each new vertex go to the next new city that is the shortest to get to. When there are no more new vertices to go to, go to the starting vertex. A (12) C (9) B (16) D (15) A = 52

NEAREST-NEIGHBOR ALGORITHMStart: Start at the designated starting vertex (home). If there is no designated starting vertex, pick any vertex.

Step 1: From the starting vertex go to its NEAREST NEIGHBOR (vertex that is the smallest weight away)

Middle Steps: From each vertex go to its nearest neighbor that hasn’t already been visited. (smallest remaining weight of possible vertices) Keep doing this until all the vertices have been visited.

Last Step: From the last neighbor (vertex) RETURN to the starting vertex (home).

Circuit Mirror Image WeightA, B, C, D, A

A, B, D, C, A

A, C, B, D, A

A, D, C, B, A

A, C, D, B, A

A, D, B, C, A

13 + 9 + 14 + 15 = 51

13 + 16 + 14 + 12 = 55

12 + 9 + 16 + 15 = 52

13

15

9

14

1612

A

B C

D

Page 14: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

PRO: EFFICIENT ALGORITHMAmount of computational effort required to implement it grows in some reasonable proportion with the size of population (vertices)ie WORKS FAST/ LESS TIME CONSUMING TO COMPLETE METHOD

CON: Not an optimal Algorithm; Answers won’t always be the OPTIMAL, but relatively close to being the best possible way

A weighted Graph may also be represented as table. Vertices along the first row and column. Weights on the interior of table.

A B C D

A AB = 12 AC = 20 AD = 8B BA = 12 BC = 20 BD = 15C CA = 20 CB = 20 CD = 17D DA = 8 DB = 15 DC = 17

Observations: 1) Diagonal is blank because NO LOOPS exist.2) Upper Right Triangle and Lower Left Triangle are Identical Numbers

a. Represent Same Edges, but are in different order of starting and ending vertices

Draw the following complete weighted graph described by table:A B C D E

A 3 4 5 6B 3 5 7 9C 4 5 6 8D 5 7 6 1E 6 9 8 1

12

8

20

171520

A

B C

D

Page 15: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

FIND THE NEAREST NEIGHBOR SOLUTION STARTING AT D:D (1) E (6) A (3) B (5) C (6) D = 21

The following Complete Weighted Graph can also be represented by the table:

A B C D E F G

A 75 50 28 35 15 22B 75 30 60 80 65 50C 50 30 40 48 35 28D 28 60 40 20 30 29E 35 80 48 20 40 32F 15 65 35 30 40 13G 22 50 28 29 32 13

A

G

FE

D

B

C A

B

C

G

FE

D

75

22

50

13

40

20

40

30 6

550

80

35

29

15

48

35

60

28

30

32

28

Page 16: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

Does BRUTE FORCE seem practical here?NO; (7-1)!= 720 POSSIBLE HAMILTON CIRCUITS

Start at Vertex A – Find the NEAREST NEIGHBOR SOLUTION: (Use table or graph)A – (15) – F – (13) – G – (28) – C – (30) – B – (60) – D – (20) - E – (35) - A = 201

HOMEWORK: pp. 223 – 225 # 29 - 31, 33, 35

Page 17: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

9

10

17

111315

A

B C

D

Section 6.7: Repetitive Nearest-Neighbor Algorithm

The Nearest Neighbor Algorithm is an EFFICIENT but NOT always ACCURATE algorithm.

Is there a way we can improve it because we like its efficiency? Compare from different starting spots

The REPETITIVE Nearest-Neighbor Algorithm: Perform the Nearest-Neighbor Algorithm for every vertex of the

graph as the starting vertex.

Compare circuits and CHOOSE the circuit with least weight of all the options. o If needed, Re-order (shift) that Hamilton Circuit to have the

DESIGNATED START vertex first.

o Re-ordered (shifted) circuits have the same weight but change its starting vertex

EXP #1: Perform the nearest neighbor algorithm for start of A.

A: A, B, D, C, A = 9 + 13 + 11+ 15 = 48

B: B, A, D, C, B = 9 + 10 + 11 + 17 = 47

C: C, D, A, B, C = 11 + 10 + 9 + 17 = 47

D: D, A, B, C, D = 10 + 9 + 17 + 11 = 47

Final Answer: A,B,C,D,A or A,D,C,B,A = 47

Page 18: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

EXAMPLE #2: Label the graph and complete the Repetitive nearest neighbor algorithm for a start of C.

EXAMPLE #3: Perform repetitive nearest neighbor algorithm for a start of B.

Final: shift A AnswerB, D, E, A, F, G, C, B B, C, G, F, A, E, D, B

HOMEWORK: p. 225 #37 – 39, 41

A B C D EA $185 $119 $152 $133B $185 $121 $150 $200C $119 $121 $174 $120D $152 $150 $174 $199E $133 $200 $120 $199

A B C D E F GA 75 50 28 35 15 22B 75 30 60 80 65 50C 50 30 40 48 35 28D 28 60 40 20 30 29E 35 80 48 20 40 32F 15 65 35 30 40 13G 22 50 28 29 32 13

START with A: a,f,g,c,b,d,e,a 201 = 5+13+28+30+60+20+35

START with B : b,c,g,f,a,d,e,b 214 =30+28+13+15+28+20+80

START with C : c,g,f,a,d,e,b,c 214 =28+13+15+28+20+80+30

START with D : d,e,a,f,g,c,b,d 221=20+35+15+13+28+50+60

START with E : e,d,a,f,g,c,b,e214= 20+28+15+13+28+30+80

START with F: f,a,g,d,e,c,b,f 229 =15+22+29+20+48+30+65

START with G: g,f,a,d,e,c,b,g204=13+15+28+20+48+30+50

A

B

C

D

E

ACEDBA = $773

BCAEDB = $722

CAEDBC = $722 (Final)

DBCAED = $722

ECADBE = $741

Page 19: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

Section 6.8: Cheapest-Link AlgorithmGOAL: Piece together a Hamilton circuit by individual edges or “LINKS” of graph trying to choose the smallest or “cheapest” weights first.

The Cheapest-Link Algorithm for N Vertices: Step #1: Pick the edge with the smallest weight first. Mark the

edge (or otherwise note that you have chosen it).o Smallest weight ANYWHERE on the graph

Step #2: Pick the next ‘cheapest’ edge anywhere in the graph. Mark or note it.

Step #3, …, N-1: Continue picking the ‘cheapest’ available edge in the graph and as long as(a) it does not close a circuit and(b) it does not result in three edges coming out of a single vertex.

(DEGREE = 2) (c) Ties can be broken at random and don’t break the two rules

HINT: Draw out the edges chosen helps to double check what is and is not available.

Step #N: Connect the last two vertices to close the circuit (you are forced to choose this edge so no need for “cheapest”)REORDER CIRCUIT TO THE NECESSARY STARTING VERTEX (N Vertices = N edges chosen for circuit)

EXAMPLE #1: Start at G

When table only, draw links to visualize circuit.

G

A

FE

D

B

C A

B

C

G

FE

D

75

22

50

13

40

20

40

306550

80

35

29

15

48 35

60

28

30 32

28

Page 20: Chapter 5 Euler Circuits€¦  · Web viewREVERSE EACH ONE OF THESE 4 CIRCUITS. What about the Hamiltonian circuits that start at B, C, D, etc.? Well, since such a circuit must pass

START IT AT G: G – F – A – D – E – C – B – G = 13 + 15 + 28 + 20 + 48 + 30 + 50 = 204

EXAMPLE #2: Start at B

HOMEWORK: pp. 225 - 6 #43-45, 47

A B C D E F GA 75 50 28 35 15 22B 75 30 60 80 65 50C 50 30 40 48 35 28D 28 60 40 20 30 29E 35 80 48 20 40 32F 15 65 35 30 40 13G 22 50 28 29 32 13

A

B

C

D

E

EXAMPLE #3: Start at DA B C D E

A $185 $119 $152 $133B $185 $121 $150 $200C $119 $121 $174 $120D $152 $150 $174 $199E $133 $200 $120 $199A – C = 119E – C = 120B – D = 150 A – D = 152E – B = 200741 = total cost

Start at D: D, A, C, E, B, D or D, B, E, C, A, D

= 741

12

24

17

21

9

19

192729

Start at B:B, A, E, C, D, BB, D, C, E, A, B