Question: Can someone explain this algorithm, im having trouble understading it because of the notation Figure 4.3 Breadth-first search. procedure bfs ( GS) Input: Graph G
Figure 4.3 Breadth-first search. procedure bfs ( GS) Input: Graph G = (V, E), directed or undirected; vertex & EV Output: For all vertices u reachable from 8, dist(u) is set to the distance from s to u. for all uEV: dist(u) = 0 dist(s) = 0 Q = [s] (queue containing just s) while Q is not empty: u= eject(Q) for all edges (u, v) E E: if dist(0) = 00: inject(0,0) dist() = dist(u)+1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
