My problem is this:
I have an undirected graph. Each edge has a cost (or weight). One of the nodes is labeled S. I want to start with S and visit each node at least once. Allowed to visit node several times. Movement along the edge is allowed several times, although this will make the solution more costly - moving along the edge with a cost of 3 will add 6 twice to the cost of the entire path. There are several “dead end” nodes on the graph, so sometimes we have to move around the edge more than once.
What is a fast algorithm for this? Is this a well-known issue?
What I'm looking for:
Quite quickly - the relative size of the graph that we are talking about is about 40-50 nodes. Therefore, the algorithm, I hope, does not take more than 10-15 seconds.
Reasonably optimal - I'm not looking for absolute optimality. Any interesting heuristics to guide the search so that the solution is almost optimal, good enough.
I will write this in python. Therefore, if you know about any python algorithm implementation, this is best.
Thanks for any help.
source share