Spanning Tree with Adjacency Lists
ST(i: vertex)
M[i] := 1;
v := G[i];
while not(v = null)
j := v.vertex;
if M[j] = 0 then
Add {i,j} to T;
ST(j);
v := v.next;
end{ST}
Main
G is array of adjacency lists;
M[i] := 0 for all i;
T is empty;
Spanning_Tree(1);
end{Main}
next
vertex
M is the marking array
Node of linked list
Previous slide
Next slide
Back to first slide
View graphic version