Place Directed Reachability in NL
Give a log-space nondeterministic reachability algorithm with a bounded path-length counter.
Assignment sources
Related exam and assignment appearances
These links mark a related idea or close version; only groups explicitly marked as exact repeats in the question map count as duplicates.
Problem
For a directed graph with vertices numbered and distinguished , give a nondeterministic -space decider for whether is reachable from . Ensure all branches halt and account for adjacency access, vertex storage, and the step counter.
Prerequisites
Know the unit definitions and how resources are measured against encoded input length. Distinguish a conditional theorem, a reduction, and an algorithm.
Hint 1
If a path exists, a simple path of at most edges exists.
Hint 2
Store only the current vertex, not the path.
Hint 3
At each step guess the next vertex and verify its edge by scanning the read-only input.
Full solution
Store a current-vertex register , initialized to , and a counter . If , accept. While , nondeterministically choose a number . Scan the read-only encoding of to verify that ; if not, reject this branch. Otherwise set , increment , and test again for . Reject when the budget is exhausted.
Each register for a vertex needs bits, as does the counter. A constant number of input-head positions and flags also requires bits under the standard read-only input/work-tape convention. For an adjacency matrix, the machine computes or scans to the relevant entry using logarithmic counters. For an adjacency-list encoding, it scans for the pair while retaining . Repeated scans affect time but not work space. Thus the total work space is .
Every branch makes at most successful edge guesses and each verification scan halts, so this is a decider rather than a semidecider. If is reachable from , remove cycles from a shortest walk to obtain a simple directed path with at most edges. One branch guesses exactly its vertices and accepts. If is not reachable, every sequence of verified edges remains a walk from and can never reach , so every branch rejects. Hence .
The algorithm may use polynomial time: there are only iterations, each with a polynomial input scan. Nondeterminism changes the acceptance semantics, not the space charged per branch; we do not store or explore all branches simultaneously.
The counter is essential for guaranteed halting because blindly guessing a walk could cycle forever. Storing a visited set would also prevent cycles but costs bits and would miss the desired log-space bound. The simple-path lemma supplies boundedness without that storage.
Checkpoints
Check both logical directions, halting of every relevant branch, and that output length and construction time are polynomial in the encoded input length.
Common mistakes
- Storing the whole guessed path or a visited bit vector.
- Omitting the counter and obtaining a non-halting branch.
- Charging space for all nondeterministic branches at once.
Sources and verification
- Merged summary, pp. 114-117
- Sipser 3e, sec. 8.4
- Arora-Barak draft, sec. 4.3
- Catalog mapping:
data/exercises.json; statements and solutions are independently written; personal submissions are non-authoritative.
Provenance and confidence
The exercise is an original synthesis. Confidence reflects verification of the mathematical claim against the textbook sources listed above; course sources are used only where direct coverage is identified.