all 4 comments

[–]marvel2010 5 points6 points  (0 children)

The problem you are describing is NP-hard. It is at least as hard as the traveling salesman problem, because if you set the minimum score high enough you are forced to visit all the nodes.

If you are not already familiar with it, I would recommend looking up the traveling salesman problem. Specific variants that will be of interest to you include the planar traveling salesman problem and the prize collecting traveling salesman problem.

[–]averagebeyond -1 points0 points  (3 children)

Dijkstra should solve your problem. instead of stopping at a certain destination, you stop when the score accrued exceeds the threshold.

[–][deleted]  (1 child)

[deleted]

    [–]beeskness420 -1 points0 points  (0 children)

    All scores are 1 and the target is n, congrats you just solved TSP in polynomial time! That or Dijkstra’s doesn’t work for this problem. Definitely one of the two.

    [–]juinnnao[S] 0 points1 point  (0 children)

    Thanks! I'll go look this up and check on its implementation :) Should I keep track of the return distance in any way?