Depth-first search on a directed graph records two clock values for every vertex and sorts every edge into one of four classes according to the state of its endpoint when the edge is examined. Match each term to the property that defines it.

Match each term
A.

Leads to a proper descendant that has already finished, without being the edge that discovered it

B.

Leads to an already finished vertex that is neither an ancestor nor a descendant

C.

Leads to an ancestor that is still on the recursion stack

D.

Leads to a neighbour that is first discovered by following this edge

E.

Clock value recorded when the search first reaches a vertex

F.

Clock value recorded once every outgoing edge of a vertex has been explored

Tree edge

Discovery time

Finish time

Cross edge

Forward edge

Back edge

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

A campus network is modelled by the undirected graph below. Each edge represents one link between locations. The distance from A to another location is the smallest number of edges in any route connecting them.


Use breadth-first search starting at A to complete the table. Enter an exact integer counting edges for each reachable location, and enter unreachable for any location that cannot be reached from A.


An undirected graph has edges AB, AC, BD, CD, CE, DF and EF, and an additional vertex G.


LocationDistance from A in edges
B
C
D
E
F
G

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

A connection map is represented by the undirected graph below. Run recursive depth-first search, which explores an unvisited neighbour's branch before returning to consider another neighbour.


Start at P and mark each vertex immediately when its recursive call begins. At every vertex, inspect neighbours in alphabetical order and recurse only into unmarked neighbours. Arrange the vertices in their order of first discovery, from earliest to latest. Record discoveries rather than returns from recursive calls.


An undirected graph has vertices P through U and edges PQ, PR, QS, QT, RT, SU and TU.


  1. 1.

    S

  2. 2.

    U

  3. 3.

    R

  4. 4.

    Q

  5. 5.

    P

  6. 6.

    T

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