开发者

An algorithmic question concerning shortest paths and such

I have a very, very large graph, and I want to find the shortest path from one vertex to another. The graph is directed and unweighted.

I have considered using some modification of Dijkstra's algorithm, but I usually use th开发者_开发问答at for weighted undirected graphs.

So then my other thought was to use a DFS, since I can treat all the weights as one.

Any suggestions? a

EDIT: Ok, I meant to say BFS, I'm sorry.


Try a BFS instead.

(Note that Dijkstra's algorithm works perfectly fine for unweighted directed graphs — it just happens that in the unweighted case, doing it smartly is essentially equivalent to a breadth-first search.)


Have you tried using A*?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜