I need an advice about the algorithm I have to use in order to find and return the shortest path in a graph like the one I uploaded. I'm lloking for the shortest path between two points, the lower left and the upper right. Thanks
I need an advice about the algorithm I have to use in order to find and return the shortest path in a graph like the one I uploaded. I'm lloking for the shortest path between two points, the lower left and the upper right. Thanks
You might consider some algorithms such as
Breadth first search
and
Depth first search.
and tweak them a bit :)
From an algorithmic point of view, the A* Algorithm is probably the most commonly used path-finding algorithm. Google fishing will come up with results aplenty.
I would agree with Ket or firstPerson. A* and Dijkstra's algorithms are going to be your best when you need to do a heuristic search involving cost for moving between nodes. I prefer A* most of the time for most purposes, but most all algorithms have their merits.