Step 1. Initialize all vertices to the ready state (STATUS = I)
Step 2. Push the starting vertex A onto STACK and change the status of A to the waiting state (STATUS = 2).
Step 3. Repeat Steps 4 and 5 until STACK is empty.
Step 4. Pop the top vertex N of STACK. Process N, and set STATUS (N) = 3; the processed state
Step 5. Examine each neighbor J of N.
(a) If STATUS (J)= 1 (ready slate), push Jonto STACK and reset STATUS (J) = 2 (waiting state).
(b) If STATUS (J)= 2 (waiting state), delete the previous J from the STACK and push the current J onto STACK
(c) If STATUS (J)= 3 (processed state), ignore the vertex J.
[End of Step 3 loop.]
Step 6. Exit.
Krijoni Kontakt