Here a directed cycle has at least one edge. If zero-length paths were treated as cycles, an edgeless one-vertex graph would already satisfy the predicate; that convention would give the trivial nonempty-graph predicate instead of the intended directed cycle detection problem.
For NL membership, guess a starting vertex , follow a guessed directed walk for between one and edges, and accept if it returns to . Store only the start, current vertex and step counter. A graph with a nonempty closed walk contains a simple directed cycle of at most edges, including a self-loop if present. Thus the algorithm uses logarithmic space and is complete for the predicate.
For hardness, reduce the directed graph reachability problem to cycle detection. Form and add the single backward arc
All layering arcs advance exactly one layer, including the waiting arcs , so the layered graph alone is a Directed acyclic graph. Any cycle in the augmented graph must contain the backward arc and therefore contains a path from to .
If is reachable from in , use a simple path of length at most and pad it with waits to exactly steps. It becomes the required layered path and closes to a cycle. Conversely, projecting such a layered path and deleting waits gives a walk from to in . This includes the case , where reachability has a zero-length witness but the augmented graph has a genuinely positive-length cycle.
There are vertices and polynomially many arcs. A transducer enumerates pairs/layers and checks old adjacency by scanning its input, using only bits. Hence this is a logspace many-one reduction, proving

Articles by others on the same topic (0)

There are currently no matching articles.