Shortest Path Dijkstra
00:00
AmazonMicrosoftGoogle
Find shortest path from source to all vertices in a weighted graph using Dijkstra's algorithm. Edges are non-negative.
Examples
Input → graph: 0
Output → 1(4), 0→2(1), 2→1(2), 1→3(1) from 0 → [0,3,1,4]
Input → Single vertex
Output → [0]
Input → Disconnected vertex
Output → infinity/unreachable