Running Time
Just like Prim's:
Priority queue contains |
V
| entries, so queue operations take
.
Call R
ELAX
at most once per edge, each might require an adjustment to the priority queue:
.
Call E
XTRACT
-M
IN
once per vertex:
.
Total:
, assuming all edges reachable from source.
Can also implement the priority queue with a simple array and get
O
(|
V
|
2
) (better for dense graphs).
Next:
A
*
Up:
DIJKSTRA'S ALGORITHM
Previous:
Correctness