Discovery and finish times on a directed graph

The directed graph below has six vertices. Its adjacency lists, each already in alphabetical order, are:

  • A: B, D
  • B: C, E
  • C: A
  • D: E
  • E: C
  • F: D, E


A directed graph with six vertices A to F in two rows, with an arrow for each edge in the adjacency lists.


Run a full depth-first search: the outer loop tries vertices in alphabetical order and starts a new search from any vertex that is still unvisited, and each call explores neighbours in list order. A single clock starts at 1 and advances by one at every discovery and every finish. Fill in the discovery and finish time of each vertex.

VertexDiscovery timeFinish time
A
B
C
D
E
F

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Graph Traversals Questions: