Documentation

CslibFrontier.Computability.Complexity.Problems.StronglyConnected.Reduction

Directed connectivity as strong connectivity #

An instance I of directed s–t connectivity becomes the digraph Cslib.Complexity.StronglyConnected.ofSTCON I on the same vertices, with the arcs of I, an arc from every vertex to s and an arc from t to every vertex. It is strongly connected exactly when t is reachable from s in I (Cslib.Complexity.StronglyConnected.ofSTCON_mem_iff): a path from s to t gives the path a → s ⇝ t → b between any two vertices, and conversely a path from s that uses a new arc either returns to s or leaves t after reaching it.

The digraph is written in logarithmic space by a counter program with output (Cslib.Complexity.StronglyConnected.writer), which reads the header of the encoded instance (Cslib.Complexity.STCONInstance.headerCode), writes the unary header 1^n 0, and then writes the matrix entry by entry, reading the entry of I unless the column is s or the row is t (Cslib.Complexity.StronglyConnected.computableInLogSpace_ofSTCON).

Main definitions #

Main results #

References #

The digraph of an instance of directed connectivity: the arcs of the instance, an arc from every vertex to s and an arc from t to every vertex.

The digraph is strongly connected exactly when t is reachable from s.

The writer #

The writer of the encoded digraph, on the encoded instance. Registers 0, 1 and 2 receive the header values n, s and t; register 3 counts the unary header and then runs over the rows, register 4 over the columns. Labels 0 to 5 read the header, the loop at label 6 writes the unary header 1^n 0, the nested loops at labels 11 and 14 write the matrix, the entry at labels 17 to 23, and label 24 halts.