GraphTheory[TravelingSalesman]
|
Calling Sequence
|
|
TravelingSalesman(G)
TravelingSalesman(G, M)
|
|
Parameters
|
|
G
|
-
|
a connected (di)graph
|
M
|
-
|
a Matrix containing edge weights (optional)
|
|
|
|
|
Description
|
|
•
|
The TravelingSalesman command returns two objects, w of type numeric and the second C a list which is a permutation of the vertices The first output is the optimal value for the traveling salesman problem, and the second is a Hamiltonian cycle that achieves the optimal value.
|
•
|
The algorithm is a branch-and-bound algorithm using the Reduce bound (see Kreher and Stinson, 1999).
|
•
|
If a second argument is specified, it is used for the weights. If an edge from vertex u to v is not in G then, regardless of the edge weight in M, it is treated as infinity.
|
•
|
If G is not a weighted graph then the adjacency matrix of G is used for the edge weights.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
>
|
|
| (4) |
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
| (5) |
|
|
Download Help Document
Was this information helpful?