-
Notifications
You must be signed in to change notification settings - Fork 229
Closed
Description
I want to improve the isomorphism documentation and discuss some improvements to the algorithm.
- Null vertices can appear in the isomorphism map if single-vertex components exist. This should either be explicitly documented or the algorithm adapted to map them, too.
- Vertex invariant functors actually require the
AdaptableUnaryFunctionconcept, notUnaryFunctionas stated (argument_typeandresult_typetypedefs) - In a named parameter call to
isomorphism, the second vertex invariant functor additionally requires amax()member function as an alternative ifvertex_max_invariantis not passed.This is undocumented.I think bothvertex_max_invariantandmax()here are misnomers, as it is demanded that they are upper exclusive bounds on the vertex invariant values (i.e. number of different values, not maximum values). Any added documentation ofmax()should have this information too, though. - Both
vertex_max_invariantandvertex_invariant2::max()are unnecessary:test_isomorphismimmediately evaluates all invariants for all vertices of both graphs, sorts them, and lexicographically compares. The upper exclusive bound on the invariant values is then the maximum of the back of both invariant lists plus one. Yes, it is then less clear why invariants must be in a contiguous range with a reasonable upper bound - which, I assume, is purely for the efficiency and memory-compactness of the invariant multiplicity calculation here:But I think that can be fixed with documentation, too. In principle, we could ignore the named parameter, even if supplied, and remove the// isomorphism.hpp, line 156 onwards std::vector<vertex1_t> V_mult; BGL_FORALL_VERTICES_T(v, G1, Graph1) V_mult.push_back(v); { std::vector<size_type> multiplicity(max_invariant, 0); BGL_FORALL_VERTICES_T(v, G1, Graph1) ++multiplicity.at(invariant1(v)); sort(V_mult, compare_multiplicity(invariant1, &multiplicity[0])); }
undocumentedrequirement onvertex_invariant2, without breaking existing code. - We could even go further and remove the range requirement on vertex invariants entirely. The multiplicity of invariants can be calculated efficiently by counting in the sorted list of invariants for one graph from the previous step. If the range requirement is removed, then it will need to be replaced by an
unordered_mapto avoid wasting memory. - Something small: The first step of
test_isomorphism, where all invariants are calculated for all vertices, does notreserve.
Thoughts?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels