Time and Space Complexity For Graph Algorithms
Time and Space Complexity For Graph Algorithms
● E = number of edges
● logV = logarithm of V
● For weighted graphs: assume edge weights are integers or real numbers.
7. Dijkstra’s Algorithm
● Time:
○ Using Fibonacci heap: O(E + V log V) (theoretically better but rarely used in
practice)
8. Bellman-Ford Algorithm
● Time:
● Time: O(E log E) (or O(E log V) if using Union-Find with path compression)
● Time: O(V^3)