As much as I rack my head, I can’t come to a viable solution; It should be noted that I am a beginner.
I have to make a route calculator where, given a map of cities, the connections between them and the city of origin and destination, I am able to find a valid route.
for a map that simple, you can build the entire thing in memory such that you define the shortest route between any two nodes.
That said, in general you can start at the start;
walk to each destination from the current node that is NOT already in the path; check to see if youve arrived. If any of the paths have arrived, you have your answer. If not, repeat the cycle for each node. If there are no nodes left to walk to, you cannot complete the journey.
(The three Spanish starting nodes can reach any destination; the Italian nodes can only end up at each other; Paris cannot get anywhere.)
OK. I will try. Thank you!
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.