alexgolec
alexgolec

Reputation: 28272

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 that 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.

Upvotes: 2

Views: 163

Answers (2)

Dimitris Andreou
Dimitris Andreou

Reputation: 8898

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.)

Upvotes: 5

David
David

Reputation: 7153

Have you tried using A*?

Upvotes: 1

Related Questions