← Student tools · Problem 42 · Lecture 15 · Round 3 (40 pts)

PATH ∈ NL · nondeterministic guess-the-path

Guess a neighbour each step; log n bits suffice per branch.

CLO-5R3·40 ptsL15
🔊 Listen

PATH = {⟨G, s, t⟩ : directed graph G has a path from s to t}. PATH is the canonical NL problem and arguably the defining example of nondeterministic log-space — it's NL-complete (Problem 43) and one of the cleanest "nondeterminism actually helps" demonstrations.

The nondeterministic algorithm
v ← s; counter ← 0
while counter ≤ |V|:
   if v = t: accept
   v ← nondet. choice from neighbours of v
   counter ← counter + 1
reject

Memory: v fits in ⌈log2 n⌉ bits, counter fits in ⌈log2(n+1)⌉ bits, plus O(1) state. Total: O(log n) work-tape space.

The algorithm wins because nondeterminism lets it guess the right next vertex at each step. Acceptance is existential: PATH accepts if any guessing sequence reaches t.

Why deterministic LOGSPACE can't do PATH (probably)

A deterministic algorithm would need to remember which neighbours it has tried. With only O(log n) bits, it can't store a non-trivial set of visited vertices. PATH ∈ L is open (whether L = NL). DFS uses too much stack for log space.

NL is closed under reductions; therefore the existence of a log-space reduction to PATH proves a problem is in NL.

🔊 Listen
Multiple branches explored in parallel · each log-n memory Auto-plays
🔊 Listen
🔊 Listen
🔊 Listen

Sipser: §8.4, Example 8.21 (PATH algorithm). Lecture notes: Module 7 slide 2. Companion problems: P41 (log space), P43 (PATH NL-complete), P44 (inductive counting / coNL = NL).