3.2.15.3. rule/CompositionMatch.hpp

3.2.15.3.1. Class rule::CompositionMatch

class rule::CompositionMatch

A class for interactively constructing match between two rules used for composition. That is, for two rules \(p_1 = (L_1 \leftarrow K_1 \rightarrow R_1)\) and \(p_2 = (L_2 \leftarrow K_2 \rightarrow R_2)\), an object represents match between \(R_1\) and \(L_2\) which indicates a common subgraph \(R_1 \leftarrow M \rightarrow L_2\).

3.2.15.3.1.1. Synopsis

explicit CompositionMatch(std::shared_ptr<Rule> rFirst, std::shared_ptr<Rule> rSecond, LabelSettings labelSettings)
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
LabelSettings getLabelSettings() const
int size() const
Rule::LeftGraph::Vertex operator[](Rule::RightGraph::Vertex vFirst) const
Rule::RightGraph::Vertex operator[](Rule::LeftGraph::Vertex vSecond) const
void push(Rule::RightGraph::Vertex vFirst, Rule::LeftGraph::Vertex vSecond)
void pop()
std::shared_ptr<Rule> compose(bool verbose) const
std::vector<std::shared_ptr<Rule>> composeAll(bool maximum, bool verbose) const

3.2.15.3.1.2. Details

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 \(p_1\) and \(p_2\).

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 \(R_1\) and \(L_2\) 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 only 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 it self.