# Traveling Salesman Problem

TSP
 The goal is, to find the most economical way for a select number of “cities” with the following restrictions: - Must visit each city once and only once - Must return to the original starting point

BASICS
 Complete Graph – vertices joined by a single edge  Weighted Graph – edges carry a value  Hamiltonian Circuit - connects all points on a graph, passes through each point only once, returns to origin  Hamiltonian Path - A route not returning to the beginning

Finding an Approximate Solution
 Edge with smallest weight is drawn first

 Edge with second smallest weight is drawn in
 Continue unless it closes a smaller circuit or three edges come out of one vertex  Finished once a complete Hamilton Circuit is drawn

Finding an Approximate Solution
 Nearest Neighbor Algorithm
 Start at any given vertex

 Travel to edge that yields smallest weight and has not
been traveled through yet  Continue until we have a complete Hamilton circuit

Nearest Neighbor Algorithm

Nearest Neighbor Algorithm

Nearest Neighbor Algorithm

Nearest Neighbor Algorithm

Nearest Neighbor Algorithm

Comparing Approximating Methods

Total weight for
Cheapest Link – 31 Nearest Neighbor – 33

A 42-City Problem (The Nearest Neighbour Method) (Starting at City 1)
5

25

8 31 24 37 32 30 11 7 23 22 29 12 19 20 36

41 14 15 40

6 26 27

28

33

9

13 42 16

2

34

35

38 17 3
17

4 1

21

10 39

18

The Nearest Neighbour Method (Starting at City 1)
5

25

8 31 24 37 32 30 11 7 23 22 29 12 19 20 36

41 14 15 40

6 26 27

28

33

9

13 42 16

2

34

35

38 17 3
18

4 1

21

10 39

18

The Nearest Neighbour Method (Starting at City 1) Length 1498
5

25

8 31 24 37 32 30 11 7 23 22 29 12 19 20 36

41 14 15 40

6 26 27

28

33

9

13 42 16

2

34

35

38 17 3
19

4 1

21

10 39

18

Remove Crossovers
5

25

8 31 24 6 26 27 7 28 30 11 37 32 36

41
14 15 40

23

33
22 13 2 29

9
12

19
20

34

42 16 17 3
20

35

4 1

38 21 10 39

18

Remove Crossovers
5

25

8 31 24 6 26 27 7 28 30 11 37 32 36

41
14 15 40

23

33
22 13 2 29

9
12

19
20

34

42 16 17 3
21

35

4 1

38 21 10 39

18

Remove Crossovers
5

Length 1453

25

8 31 24 6 26 27 7 28 30 11 37 32 36

41
14 15 40

23

33
22 13 2 29

9
12

19
20

34

42 16 17 3
22

35

4 1

38 21 10 39

18

Applications of the TSP
 Computer Wiring - connecting together computer components using minimum wire length  Archaeological Seriation - ordering sites in time  Genome Sequencing - arranging DNA fragments in

sequence
 Planning, logistics, and the manufacture of microchips

THANK YOU