:
- While vertices remain unsorted:
- Select any unsorted vertex and add to a stack
- While stack is not empty:
- Inspect top element on stack
- If has no unsorted neighbours:
- Pop from stack and add to list
- Else: add unsorted neighbours of to stack
- Return sorted list