Dijkstra’s Algorithm (Link State)
💡 The Core Idea
Dijkstra’s algorithm calculates the least-cost path from a source node to all other nodes in a network by iteratively adding the closest unvisited node to a set of confirmed nodes ().
🧠 Mechanism
- Initialization: The source node knows the cost to its immediate neighbors. All non-neighbors are set to infinity.
- Iteration:
- Select the node () outside of set with the lowest cost.
- Add to .
- Update neighbors of : Is it cheaper to go through to get to neighbor ?
- .
- Completion: Algorithm stops when all nodes are in (requires iterations).
Complexity
The computational complexity is , where is the number of nodes.
🔗 Connections
- Source: Source - Intradomain Routing