Loading...
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
Find the shortest distance from any source node to all other vertices. By initializing the queue with multiple sources simultaneously, we simulate concurrent propagation fronts across the graph.
Instead of running BFS multiple times, we inject all sources at once. The first front to reach a node defines its shortest distance.
Conceptually, this is equivalent to adding a "super source" node connected to all real sources with edge weight 0.