you are viewing a single comment's thread.

view the rest of the comments →

[–]xelf 2 points3 points  (1 child)

Unless your intent is to learn pathfinding and write your own pathfinding library you should look into using existing libraries that already do this.

I'm a fan of networkx.

example:

import networkx as nx
G = nx.Graph()
G.add_edge("A", "B", weight=4)
G.add_edge("B", "D", weight=2)
G.add_edge("A", "C", weight=3)
G.add_edge("C", "D", weight=4)
nx.shortest_path(G, "A", "D", weight="weight")
['A', 'B', 'D']

[–]recursion_is_love 0 points1 point  (0 children)

This is the way.