The adjacency-matrix encoding of undirected graphs #
An undirected graph instance (Cslib.Complexity.UGraphInstance) is a simple graph on Fin n,
given by a symmetric adjacency matrix with zero diagonal. It is encoded
(Cslib.Complexity.encUGraph) as its digraph (Cslib.Complexity.encDigraph): the unary header
1^n 0 followed by the adjacency matrix row by row, so that the bit at n + 1 + (a * n + b) is
the entry of the row a and the column b.
Main definitions #
Cslib.Complexity.UGraphInstance.toDigraph: the digraph of an instance.Cslib.Complexity.encUGraph: the encoding of instances.
Main results #
Cslib.Complexity.UGraphInstance.encode_injective: the encoding is injective.Cslib.Complexity.UGraphInstance.length_encode,Cslib.Complexity.UGraphInstance.getElem?_encode_n,Cslib.Complexity.UGraphInstance.getElem?_encode_matrix: the length of the encoding, and its bits read by position.
The digraph of an instance, with an arc in each direction for every edge.
The encoding of an instance, that of its digraph (Cslib.Complexity.encDigraph): the unary
header 1^n 0, then the adjacency matrix row by row.
The encoding is injective.
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 of undirected graphs: the unary header 1^n 0, then the adjacency matrix row by
row.