5.2. canonicalization.hpp¶
Full path: graph_canon/canonicalization.hpp
-
template<typename
SizeTypeT, boolParallelEdgesV, boolLoopsV, typenameGraphT, typenameIndexMapT, typenameEdgeHandlerT>
classconfig¶ A helper-class for holding type aliases.
-
static constexpr bool
ParallelEdges= ParallelEdgesV¶ Indicator for whether the graph can have parallel edges.
-
using
EdgeHandler= EdgeHandlerT¶ The type of
EdgeHandlerused.
-
static constexpr bool
-
template<typename
ConfigT, typenameVisitorT>
classcanon_state¶ A class template representing he state of a canonicalization run. A reference to an object of this class will be passed to almost all functions in plugins. Note that the user is not supposed to instantiate an object of this class manually.
-
type
SizeType¶ The integer type used as element type in various arrays.
-
type
Graph¶ The type of the input graph.
-
type
IndexMap¶ The
ReadablePropertyMapgiven to map vertices to indices.
-
type
EHandler¶ The
EdgeHandlertype used.
-
static constexpr bool
ParallelEdges¶ Configuration value for whether the given graph may have parallel edges or not.
-
static constexpr bool
Loops¶ Configuration value for whether the given graph may have loop edges or not.
-
type
Partition¶ The type of
OrderedPartitionused in the algorithm.
-
type
TreeNode¶ The type used for instantiating tree nodes.
-
type
OwnerPtr¶ A smart-pointer type that keeps a tree node alive (e.g., by reference counting).
-
type
InstanceData¶ Instance data defined, e.g., by visitors, is all stored in an object of this type
-
void
report_leaf(OwnerPtr node)¶ Submit a tree node as a valid leaf of the search tree.
Requires that the ordered partition represented by
nodeis discrete, and thatreport_leafhas not been called before with this node.Several
Visitormethods may be called from this function:Visitor::tree_leaf, always called.Visitor::canon_new_best, if this node will be the best candidate leaf afterwards.Visitor::automorphism_leaf, if this node represents a canonical representation, equal to the current best candidate.Visitor::canon_worse, if this nodes represents a worse representation than the current best candidate.
-
void
prune_canon_leaf()¶ Prune the current best candidate. Requires that at least one leaf will be added with
repoort_leaflater.
-
TreeNode *
get_canon_leaf() const¶ - Returns
a pointer to the tree node representing the current best candidate.
-
InstanceData
data¶ The aggregated data structure holding all instance data. Use
get(my_tag(), data)to access your data, tagged with some tagmy_tag.
-
EHandler &
edge_handler¶ A reference to the
EdgeHandlerused for this run.
-
type
-
template<typename
SizeType, typenameEdgeHandlerCreatorT, boolParallelEdges, boolLoops>
classcanonicalizer¶ A reusable function object for canonicalizing graphs.
Requires
SizeTypeto be an integer type andEdgeHandlerCreatorTto be anEdgeHandlerCreator.-
using
EdgeHandler= typename EdgeHandlerCreatorT::template type<SizeType>¶
-
canonicalizer(EdgeHandlerCreatorT edge_handler_creator)¶
-
template<typename
Graph, typenameIndexMap, typenameVertexLess, typenameVis>
autooperator()(const Graph &g, IndexMap idx, VertexLess vertex_less, Vis visitor)¶ Compute a permutation that permutes the indices of the vertices of
ginto their canonical indices.Requires:
Graphmust be aVertexListGraph, anEdgeListGraph, and aBidirectionalGraph.IndexMapmust be aReadablePropertyMapthat maps the vertices ofginto contiguous indices starting from 0.VertexLessmust be a less-than predicate on the vertices ofgthat induces a strict weak ordering. The resulting canonical vertex order respects the ordering induced byvertex_less.Vismust be aVisitortype. Note that aninvariant_coordinatoris automatically prepended to the given visitor.
Note
Currently the expression
vertex(i, g)for a vertex indexiis also required to be valid, and returning the corresponding vertex descriptor. It must be the inverse of the index mapidx. This requirement will be lifted in a future version.- Returns
A
std::pair<std::vector<SizeType>, Data>wherefirstis the permutation, andsecondis the auxiliary visitor data of an unspecified typeData. See each visitor for what data they may return and what it is tagged with. Useget(the_tag(), res.second)to access the data tagged withthe_tagfrom the return valueres.
-
using
-
template<typename
SizeType, boolParallelEdges, boolLoops, typenameGraph, typenameIndexMap, typenameVertexLess, typenameEdgeHandlerCreatorT, typenameVisitor>
autocanonicalize(const Graph &graph, IndexMap idx, VertexLess vertex_less, EdgeHandlerCreatorT edge_handler_creator, Visitor visitor)¶ A shorhand function for canonicalization. The
SizeType,ParallelEdges, andLoopsmust be specified explicitly while remaining template parameters can be deduced.See
canonicalizer::.operator()