FindShortestTour[{e1, e2, ...}]
attempts to find an ordering of the that minimizes the total distance on a tour that visits all the once.

Details and OptionsDetails and Options

  • FindShortestTour returns a list of the form , where is the length of the tour found, and is the ordering.
  • The following options can be given:
  • DistanceFunctionthe distance function to apply to pairs of objects
    Methodthe method to use
  • The can be numbers or lists of numbers, in which case the default distance function used is EuclideanDistance.
  • If the are strings, the default distance function used is EditDistance.
  • For small numbers of points, FindShortestTour will usually find the shortest possible tour. For larger numbers of points, it will normally find a tour whose length is at least close to the minimum.
  • Possible settings for the Method option include , , , , , , , , , , and .
  • For small numbers of points in the Euclidean space, an method is used, which is guaranteed to give the shortest tour.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Find the length and ordering of the shortest tour through six points in the plane:

Click for copyable input

Specify a list of points:

Click for copyable input
Click for copyable input

Order the points according to the tour found:

Click for copyable input

Plot the tour:

Click for copyable input
New in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »