Spanning Tree using Breadth First Search
Initialize T to be empty;
Initialize Q to be empty;
Enqueue(1,Q) and mark 1;
while Q is not empty do
i := Dequeue(Q);
for each j adjacent to i do
if j is not marked then
add {i,j} to T;
Enqueue(j,Q) and mark j
Previous slide
Next slide
Back to first slide
View graphic version