❓ Question

How are the shortest path above and the traveling salesperson problems given above similar?

How are they different?

💡 Answer

Both problems are graph problems and seek the optimal path to fulfill certain criteria.

The difference is that while a Traveling Sales Person is seeking to tour all the nodes, the shortest path is seeking to tour a few nodes optimally.

In the shortest path, when represented as a graph the objective is to find the smallest weight along a path between the two nodes.

In traveling salesperson the object is to minimize the total distance traveled in a tour, visiting each node exactly once