Testing Reachability from One Vertex

A vertex is reachable when a sequence of permitted edges leads to it from the source, including the trivial route to the source itself.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace the frontier
  2. Return a witness when requested
  3. Close the reachable set under available moves
  4. Include or exclude the starting vertex explicitly

Trace the frontier

With edges A to B, B to C, and D to A, starting at A reaches A, B, and C. D remains outside that reachable set. Directed edges explain why an incoming edge cannot be followed backwards.

Return a witness when requested

Recording a predecessor at discovery lets the result exhibit A, B, C for C. A Boolean result alone proves less to a reader. See decision results and witnesses.[1]

Close the reachable set under available moves

Let A point to B and D, B point to C, and C point back to B. Starting at A reaches A, B, D and C. The cycle between B and C should not lead to indefinite exploration. Mark discovered states before expanding them. See using a visited set.

Start {A}, inspect A → add B,D
Inspect B → add C
Inspect C → B already seen
Inspect D → no additions
Final reachable set {A,B,C,D}

Include or exclude the starting vertex explicitly

Ordinary reachability permits a length-zero path, so A reaches itself. A query about a return journey may require a positive length instead. Test an isolated start and one that can return via a cycle.

References

  1. Eric Lehman, F. Thomson Leighton and Albert R. Meyer, Mathematics for Computer Science ↩