Strongly connected digraphs #
A digraph instance (Cslib.Complexity.DigraphInstance) is a directed graph on Fin n, given by
its adjacency matrix; it belongs to Cslib.Complexity.StronglyConnected when every vertex reaches
every vertex by a directed path, of any length, including the empty path. The adjacency matrix
need not be symmetric and may have loops; the empty digraph is strongly connected.
Instances are encoded (Cslib.Complexity.encDigraph) as instances of directed connectivity are
(Cslib.Complexity.encSTCON), without the source and the target: the unary header 1^n 0
followed by the adjacency matrix row by row (Cslib.Complexity.adjacencyMatrix), so that the bit
at n + 1 + a * n + b is the entry of the row a and the column b. This is the encoding of
Arora and Barak, Exercise 4.4, which asks to show that the language is
NL-complete (Cslib.Complexity.StronglyConnected.logSpaceComplete).
Main definitions #
Cslib.Complexity.DigraphInstance: digraphs given by adjacency matrices.Cslib.Complexity.DigraphInstance.Adj: the arcs of a digraph.Cslib.Complexity.encDigraph: the encoding of digraphs.Cslib.Complexity.StronglyConnected: the strongly connected digraphs.
Main results #
Cslib.Complexity.DigraphInstance.getElem?_encode_n,Cslib.Complexity.DigraphInstance.getElem?_encode_matrix: the bits of the header and of the matrix, read by position.Cslib.Complexity.DigraphInstance.length_encode: the length of the encoding.Cslib.Complexity.DigraphInstance.encode_injective: the encoding is injective.
References #
The arcs of a digraph: there is an arc from a to b when the entry of the row a and the
column b of the adjacency matrix is set.
The encoding of a digraph: the unary header 1^n 0, then the adjacency matrix row by row.
The entries of the matrix, read by position: the bit at n + 1 + (a * n + b) is the entry
of the row a and the column b.
The encoding is injective.
The encoding of digraphs: the unary header 1^n 0, then the adjacency matrix row by row.
Strongly connected digraphs: every vertex reaches every vertex by a directed path.