3.2.14.3. rule/CompositionMatch.hpp

class rule::CompositionMatch

A class for interactively constructing match between two rules used for composition. That is, for two rules p1=(L1K1R1) and p2=(L2K2R2), an object represents match between R1 and L2 which indicates a common subgraph R1ML2.

See also [AFMS-RC] for details of how composition of rules can be computed.

explicit CompositionMatch(std::shared_ptr<Rule> rFirst, std::shared_ptr<Rule> rSecond, LabelSettings labelSettings)

Construct an empty overlap.

Throws:

LogicError – if either rule is null.

CompositionMatch(const CompositionMatch &other)
CompositionMatch &operator=(const CompositionMatch &other)
friend std::ostream &operator<<(std::ostream &s, const CompositionMatch &mb)
std::shared_ptr<Rule> getFirst() const
std::shared_ptr<Rule> getSecond() const
Returns:

the rules p1 and p2.

LabelSettings getLabelSettings() const
Returns:

the settings for the morphisms in the match.

int size() const
Returns:

the number of currently mapped pairs of vertices.

Rule::LeftGraph::Vertex operator[](Rule::RightGraph::Vertex vFirst) const
Rule::RightGraph::Vertex operator[](Rule::LeftGraph::Vertex vSecond) const
Returns:

the vertex the given vertex is mapped to, or a null vertex if it is not mapped.

Throws:
  • LogicError – if either vertex is a null vertex.

  • LogicError – if either vertex does not belong to their respective rules.

void push(Rule::RightGraph::Vertex vFirst, Rule::LeftGraph::Vertex vSecond)

Extend the common subgraph (match) of R1 and L2 by identifying the given vertices from each of the graphs.

Throws:
  • LogicError – if either vertex is a null vertex.

  • LogicError – if either vertex does not belong to their respective rules.

  • LogicError – if either vertex is already mapped.

  • LogicError – if the extension of the match is infeasible.

void pop()

Pop the latest pushed vertex pair.

Throws:

LogicError – if size() == 0.

std::shared_ptr<Rule> compose(bool verbose) const
Parameters:

verbose – whether to output debug messages from the composition algorithm.

Returns:

the composition of the two rules along the match. If the composition is not defined, a null pointer is returned.

std::vector<std::shared_ptr<Rule>> composeAll(bool maximum, bool verbose) const
Parameters:
  • maximum – whether to only compose using the matches of maximum cardinality.

  • verbose – whether to output debug messages from the composition algorithm.

Returns:

the composition of the two rules along enumerated matches. The enumerated matches are all those that are extensions of the current match, and the match itself.