# What is the fastest algorithm for finding shortest path in undirected edge-weighted graph?

I am looking for the most efficient algorithm for finding shortest path between two Vertices.

The graph is:

• undirected
• edge-weighted
• Non-negative
• less then 300 nodes

I understand that most of the algorithms based on Dijkstra's shortest path algorithm. But which one is the most efficient for the case a specified above. Thank you.

• What algorithms have you considered? When you say "most efficient", do you care about theoretical running time or practical efficiency? What have you tried? For 300 nodes, it's not going to matter: that's a tiny graph, and anything reasonable will be super-fast. – D.W. Dec 9 '15 at 17:25
• I am considering A*, Dijsktra's, Bellman–Ford algorithm... As I am reading on Wikipedia about it, it just says about directed graphs. Bellman–Ford algorithm can be used with negative graphs but slower then Dijkstra's. Getting confused more and more. I care about theoretical time (300 nodes at the beginning, might increase later on). – Firstname Lastname Dec 9 '15 at 17:37
• Djikstras should be very reasonable for your interests. If you want some more fun: Fibonacci-Heaps are a quite good data structure to speed things up. – Danny Dec 9 '15 at 17:59
• The theoretical running time of those is all covered in standard textbooks and online resources (e.g., Wikipedia), so it seems like you have everything to answer your question on your own. Please edit your question to show your work: show what algorithms you've considered, what their running time is, which seems to be the best, and identify what your remaining question is. – D.W. Dec 9 '15 at 18:14
• @Danny I'm not sure Fibonacci heaps are that fast in practice though (there should be other alternative though). – Juho Dec 9 '15 at 19:06

You mentioned in a comment that your main concern is that the algorithms are described for directed graphs, but you have an undirected graph. No worries. You can apply Dijkstra's algorithm to an undirected graph, too. Whenever your graph has an undirected edge between vertices $u$ and $v$, think of that as equivalent to the two directed edges $u \to v$ and $v \to u$. In this way, you can convert your undirected graph to a directed graph -- and then you can apply Dijkstra's algorithm to the result. The same goes for any other algorithm for directed graphs; it can be applied to an undirected graph in the same way.