views:

49

answers:

3

Is there an algorithm that will allow me to traverse a weighted graph in the following manner?

  • Start at a specific node
  • Go through all vertecies in the graph
  • Do this in the least amount of time (weights are times)
  • End up at the starting node
+6  A: 

Sounds like the Travelling Salesman Problem to me. An NP-hard problem. There is no polynomial time algorithm that will give you the optimum solution. You could use a search heuristic to get a close to optimal solution though.

Greg Sexton
+1  A: 

I am not sure, if any efficient algorithm exists, but a brute force approach would surely give you the answer.

In any case, can you give the constraints on the number of vertices/edges.

Gunner
+1  A: 

As Greg Sexton stated before me, it is a classic example of the Travelling Salesman Problem. There are many advanced algorithms about for handling this style of problem, which is best for your particular situation rather depends on the graph. If the number of vertices is high, you will need substantial computational power to get it done within a realistic time frame.

Orbling