Canonical forms¶
vefr/nauty.hpp, linked as vefr::vefr (nauty comes with pyurd_native).
A canonical form is a graph relabelled by nauty so that two colored graphs are isomorphic exactly when their canonical forms are equal. Equal colors are what an isomorphism must keep: nauty’s cells are the vertices of each color, in increasing order of color.
-
using Numbers = urd::Store<urd::sequence<std::uint32_t>>¶
-
struct CanonicalForm¶
-
bool digraph¶
Whether nauty read it as directed: where the graph is not symmetric or has loops.
-
bool digraph¶
-
template<urd::adjacency_graph G, coloring<vertex_t<G>> F>
CanonicalForm canonical_form(const G &g, const F &coloring = uncolored)¶ Directed graphs and loops are fine. Parallel edges throw
std::invalid_argument. nauty keeps global state: call it from one thread at a time.
-
std::optional<Numbers> isomorphism(const CanonicalForm &a, const CanonicalForm &b)¶
An isomorphism from
a’s graph tob’s, by vertex position, if their forms are equal: a vertex at positionpmaps to the vertex at position(*isomorphism(a, b))[p].