3.2.15.5. rule/GraphInterface.hpp

This header contains the definitions for the graph interface for rule::Rule.

3.2.15.5.1. Left

3.2.15.5.1.1. Class rule::Rule::LeftGraph

class rule::Rule::LeftGraph

A proxy object representing the left graph of the rule.

3.2.15.5.1.1.1. Synopsis

friend bool operator==(const LeftGraph &a, const LeftGraph &b)
friend bool operator!=(const LeftGraph &a, const LeftGraph &b)
friend bool operator<(const LeftGraph &a, const LeftGraph &b)
friend std::ostream &operator<<(std::ostream &s, const LeftGraph &g)
std::size_t numVertices() const
VertexRange vertices() const
std::size_t numEdges() const
EdgeRange edges() const
std::shared_ptr<Rule> getRule() const
class rule::Rule::LeftGraph::Vertex
class rule::Rule::LeftGraph::Edge
class rule::Rule::LeftGraph::VertexIterator
class rule::Rule::LeftGraph::VertexRange
class rule::Rule::LeftGraph::EdgeIterator
class rule::Rule::LeftGraph::EdgeRange
class rule::Rule::LeftGraph::IncidnetEdgeIterator
class rule::Rule::LeftGraph::IncidentEdgeRange

3.2.15.5.1.1.2. Details

friend bool operator==(const LeftGraph &a, const LeftGraph &b)
friend bool operator!=(const LeftGraph &a, const LeftGraph &b)
friend bool operator<(const LeftGraph &a, const LeftGraph &b)
friend std::ostream &operator<<(std::ostream &s, const LeftGraph &g)
std::size_t numVertices() const
Returns

the number of vertices in the graph.

VertexRange vertices() const
Returns

a range of all vertices in the graph.

std::size_t numEdges() const
Returns

the number of edges in the graph.

EdgeRange edges() const
Returns

a range of all edges in the graph.

std::shared_ptr<Rule> getRule() const
Returns

the rule where the graph belongs to.

3.2.15.5.1.2. Class rule::Rule::LeftGraph::Vertex

class rule::Rule::LeftGraph::Vertex

A descriptor of either a vertex in a rule, or a null vertex.

3.2.15.5.1.2.1. Synopsis

Vertex()
explicit operator bool() const
bool isNull() const
std::size_t getId() const
LeftGraph getGraph() const
std::size_t getDegree() const
IncidentEdgeRange incidentEdges() const
const std::string &getStringLabel() const
AtomId getAtomId() const
Isotope getIsotope() const
Charge getCharge() const
bool getRadical() const
std::string printStereo() const
std::string printStereo(const graph::Printer &p) const
Rule::Vertex getCore() const
std::shared_ptr<Rule> getRule() const

3.2.15.5.1.2.2. Details

Vertex()

Constructs a null descriptor.

explicit operator bool() const
Returns

!isNull()

bool isNull() const
Returns

whether this is a null descriptor or not.

std::size_t getId() const
Returns

the index of the vertex. It will be in the range \([0, numVertices[\).

Throws

LogicError if it is a null descriptor.

LeftGraph getGraph() const
Returns

the graph the vertex belongs to.

Throws

LogicError if it is a null descriptor.

std::size_t getDegree() const
Returns

the degree of the vertex.

Throws

LogicError if it is a null descriptor.

IncidentEdgeRange incidentEdges() const
Returns

a range of incident edges to this vertex.

Throws

LogicError if it is a null descriptor.

const std::string &getStringLabel() const
Returns

the string label of the vertex.

Throws

LogicError if it is a null descriptor.

AtomId getAtomId() const
Returns

the atom id of the vertex.

Throws

LogicError if it is a null descriptor.

Isotope getIsotope() const
Returns

the isotope of the vertex.

Throws

LogicError if it is a null descriptor.

Charge getCharge() const
Returns

the charge of the vertex.

Throws

LogicError if it is a null descriptor.

bool getRadical() const
Returns

the radical status of the vertex.

Throws

LogicError if it is a null descriptor.

std::string printStereo() const
std::string printStereo(const graph::Printer &p) const

Print the stereo configuration for the vertex.

Returns

the name of the PDF-file that will be compiled in post-processing.

Throws

LogicError if it is a null descriptor.

Rule::Vertex getCore() const
Returns

the descriptor for this vertex in the core graph.

std::shared_ptr<Rule> getRule() const
Returns

the rule the vertex belongs to.

Throws

LogicError if it is a null descriptor.

3.2.15.5.1.3. Class rule::Rule::LeftGraph::Edge

class rule::Rule::LeftGraph::Edge

A descriptor of either an edge in a rule, or a null edge.

3.2.15.5.1.3.1. Synopsis

Edge()
explicit operator bool() const
bool isNull() const
LeftGraph getGraph() const
Vertex source() const
Vertex target() const
const std::string &getStringLabel() const
BondType getBondType() const
Rule::Edge getCore() const
std::shared_ptr<Rule> getRule() const

3.2.15.5.1.3.2. Details

Edge()

Constructs a null descriptor.

explicit operator bool() const
Returns

!isNull()

bool isNull() const
Returns

whether this is a null descriptor or not.

LeftGraph getGraph() const
Returns

the graph the edge belongs to.

Throws

LogicError if it is a null descriptor.

Vertex source() const
Returns

the source vertex of the edge.

Throws

LogicError if it is a null descriptor.

Vertex target() const
Returns

the target vertex of the edge.

Throws

LogicError if it is a null descriptor.

const std::string &getStringLabel() const
Returns

the string label of the edge.

Throws

LogicError if it is a null descriptor.

BondType getBondType() const
Returns

the bond type of the edge.

Throws

LogicError if it is a null descriptor.

Rule::Edge getCore() const
Returns

the descriptor for this edge in the core graph.

std::shared_ptr<Rule> getRule() const
Returns

the rule the edge belongs to.

Throws

LogicError if it is a null descriptor.

3.2.15.5.1.4. Class rule::Rule::LeftGraph::VertexIterator

class rule::Rule::LeftGraph::VertexIterator

An iterator for traversing all vertices in a rule. It models a forward iterator.

3.2.15.5.1.4.1. Synopsis

VertexIterator()

3.2.15.5.1.4.2. Details

VertexIterator()

Construct a past-the-end iterator.

3.2.15.5.1.5. Class rule::Rule::LeftGraph::VertexRange

class rule::Rule::LeftGraph::VertexRange

A range of all vertices in a rule.

3.2.15.5.1.5.1. Synopsis

3.2.15.5.1.6. Class rule::Rule::LeftGraph::EdgeIterator

class rule::Rule::LeftGraph::EdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

3.2.15.5.1.6.1. Synopsis

EdgeIterator()

3.2.15.5.1.6.2. Details

EdgeIterator()

Construct a past-the-end iterator.

3.2.15.5.1.7. Class rule::Rule::LeftGraph::EdgeRange

class rule::Rule::LeftGraph::EdgeRange

A range of all edges in a rule.

3.2.15.5.1.7.1. Synopsis

3.2.15.5.1.8. Class rule::Rule::LeftGraph::IncidnetEdgeIterator

class rule::Rule::LeftGraph::IncidnetEdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

3.2.15.5.1.8.1. Synopsis

IncidentEdgeIterator()

3.2.15.5.1.8.2. Details

IncidentEdgeIterator()

Construct a past-the-end iterator.

3.2.15.5.1.9. Class rule::Rule::LeftGraph::IncidentEdgeRange

class rule::Rule::LeftGraph::IncidentEdgeRange

A range of all incident edges to a vertex in a rule.

3.2.15.5.1.9.1. Synopsis

3.2.15.5.2. Context

3.2.15.5.2.1. Class rule::Rule::ContextGraph

class rule::Rule::ContextGraph

A proxy object representing the context graph of the rule.

3.2.15.5.2.1.1. Synopsis

friend bool operator==(const ContextGraph &a, const ContextGraph &b)
std::size_t numVertices() const
VertexRange vertices() const
std::size_t numEdges() const
EdgeRange edges() const
std::shared_ptr<Rule> getRule() const
class rule::Rule::ContextGraph::Vertex
class rule::Rule::ContextGraph::Edge
class rule::Rule::ContextGraph::VertexIterator
class rule::Rule::ContextGraph::VertexRange
class rule::Rule::ContextGraph::EdgeIterator
class rule::Rule::ContextGraph::EdgeRange
class rule::Rule::ContextGraph::IncidnetEdgeIterator
class rule::Rule::ContextGraph::IncidentEdgeRange

3.2.15.5.2.1.2. Details

friend bool operator==(const ContextGraph &a, const ContextGraph &b)
std::size_t numVertices() const
Returns

the number of vertices in the graph.

VertexRange vertices() const
Returns

a range of all vertices in the graph.

std::size_t numEdges() const
Returns

the number of edges in the graph.

EdgeRange edges() const
Returns

a range of all edges in the graph.

std::shared_ptr<Rule> getRule() const
Returns

the rule where the graph belongs to.

3.2.15.5.2.2. Class rule::Rule::ContextGraph::Vertex

class rule::Rule::ContextGraph::Vertex

A descriptor of either a vertex in a rule, or a null vertex.

3.2.15.5.2.2.1. Synopsis

Vertex()
explicit operator bool() const
bool isNull() const
std::size_t getId() const
ContextGraph getGraph() const
std::size_t getDegree() const
IncidentEdgeRange incidentEdges() const
Rule::Vertex getCore() const
std::shared_ptr<Rule> getRule() const

3.2.15.5.2.2.2. Details

Vertex()

Constructs a null descriptor.

explicit operator bool() const
Returns

!isNull()

bool isNull() const
Returns

whether this is a null descriptor or not.

std::size_t getId() const
Returns

the index of the vertex. It will be in the range \([0, numVertices[\).

Throws

LogicError if it is a null descriptor.

ContextGraph getGraph() const
Returns

the graph the vertex belongs to.

Throws

LogicError if it is a null descriptor.

std::size_t getDegree() const
Returns

the degree of the vertex.

Throws

LogicError if it is a null descriptor.

IncidentEdgeRange incidentEdges() const
Returns

a range of incident edges to this vertex.

Throws

LogicError if it is a null descriptor.

Rule::Vertex getCore() const
Returns

the descriptor for this vertex in the core graph.

std::shared_ptr<Rule> getRule() const
Returns

the rule the vertex belongs to.

Throws

LogicError if it is a null descriptor.

3.2.15.5.2.3. Class rule::Rule::ContextGraph::Edge

class rule::Rule::ContextGraph::Edge

A descriptor of either an edge in a rule, or a null edge.

3.2.15.5.2.3.1. Synopsis

Edge()
explicit operator bool() const
bool isNull() const
ContextGraph getGraph() const
Vertex source() const
Vertex target() const
std::shared_ptr<Rule> getRule() const
Rule::Edge getCore() const

3.2.15.5.2.3.2. Details

Edge()

Constructs a null descriptor.

explicit operator bool() const
Returns

!isNull()

bool isNull() const
Returns

whether this is a null descriptor or not.

ContextGraph getGraph() const
Returns

the graph the edge belongs to.

Throws

LogicError if it is a null descriptor.

Vertex source() const
Returns

the source vertex of the edge.

Throws

LogicError if it is a null descriptor.

Vertex target() const
Returns

the target vertex of the edge.

Throws

LogicError if it is a null descriptor.

std::shared_ptr<Rule> getRule() const
Returns

the rule the edge belongs to.

Throws

LogicError if it is a null descriptor.

Rule::Edge getCore() const
Returns

the descriptor for this edge in the core graph.

3.2.15.5.2.4. Class rule::Rule::ContextGraph::VertexIterator

class rule::Rule::ContextGraph::VertexIterator

An iterator for traversing all vertices in a rule. It models a forward iterator.

3.2.15.5.2.4.1. Synopsis

VertexIterator()

3.2.15.5.2.4.2. Details

VertexIterator()

Construct a past-the-end iterator.

3.2.15.5.2.5. Class rule::Rule::ContextGraph::VertexRange

class rule::Rule::ContextGraph::VertexRange

A range of all vertices in a rule.

3.2.15.5.2.5.1. Synopsis

3.2.15.5.2.6. Class rule::Rule::ContextGraph::EdgeIterator

class rule::Rule::ContextGraph::EdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

3.2.15.5.2.6.1. Synopsis

EdgeIterator()

3.2.15.5.2.6.2. Details

EdgeIterator()

Construct a past-the-end iterator.

3.2.15.5.2.7. Class rule::Rule::ContextGraph::EdgeRange

class rule::Rule::ContextGraph::EdgeRange

A range of all edges in a rule.

3.2.15.5.2.7.1. Synopsis

3.2.15.5.2.8. Class rule::Rule::ContextGraph::IncidnetEdgeIterator

class rule::Rule::ContextGraph::IncidnetEdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

3.2.15.5.2.8.1. Synopsis

IncidentEdgeIterator()

3.2.15.5.2.8.2. Details

IncidentEdgeIterator()

Construct a past-the-end iterator.

3.2.15.5.2.9. Class rule::Rule::ContextGraph::IncidentEdgeRange

class rule::Rule::ContextGraph::IncidentEdgeRange

A range of all incident edges to a vertex in a rule.

3.2.15.5.2.9.1. Synopsis

3.2.15.5.4. Core

3.2.15.5.4.1. Class rule::Rule::Vertex

class rule::Rule::Vertex

A descriptor of either a vertex in a rule, or a null vertex.

3.2.15.5.4.1.1. Synopsis

Vertex()
explicit operator bool() const
bool isNull() const
std::size_t getId() const
std::shared_ptr<Rule> getGraph() const
std::shared_ptr<Rule> getRule() const
LeftGraph::Vertex getLeft() const
ContextGraph::Vertex getContext() const
RightGraph::Vertex getRight() const
std::size_t getDegree() const
IncidentEdgeRange incidentEdges() const
double get2DX(bool withHydrogens = true)
double get2DY(bool withHydrogens = true)

3.2.15.5.4.1.2. Details

Vertex()

Constructs a null descriptor.

explicit operator bool() const
Returns

!isNull()

bool isNull() const
Returns

whether this is a null descriptor or not.

std::size_t getId() const
Returns

the index of the vertex. It will be in the range \([0, numVertices[\).

Throws

LogicError if it is a null descriptor.

std::shared_ptr<Rule> getGraph() const
std::shared_ptr<Rule> getRule() const
Returns

the graph the vertex belongs to, which happens to be the rule object it self.

Throws

LogicError if it is a null descriptor.

LeftGraph::Vertex getLeft() const
Returns

a null descriptor if this vertex is not in the left graph, otherwise the descriptor of this vertex in the left graph.

ContextGraph::Vertex getContext() const
Returns

a null descriptor if this vertex is not in the context graph, otherwise the descriptor of this vertex in the context graph.

RightGraph::Vertex getRight() const
Returns

a null descriptor if this vertex is not in the right graph, otherwise the descriptor of this vertex in the right graph.

std::size_t getDegree() const
Returns

the degree of the vertex.

Throws

LogicError if it is a null descriptor.

IncidentEdgeRange incidentEdges() const
Returns

a range of incident edges to this vertex.

Throws

LogicError if it is a null descriptor.

double get2DX(bool withHydrogens = true)
Returns

the x-coordinate in a 2D depiction of the rule. Different sets of coordinates exists for rendering with and wihout certain hydrogens.

Throws

LogicError if it is a null descriptor, or if withHydrogens is true and the vertex is a “clean” hydrogen.

double get2DY(bool withHydrogens = true)
Returns

the y-coordinate in a 2D depiction of the rule. Different sets of coordinates exists for rendering with and wihout certain hydrogens.

Throws

LogicError if it is a null descriptor, or if withHydrogens is true and the vertex is a “clean” hydrogen.

3.2.15.5.4.2. Class rule::Rule::Edge

class rule::Rule::Edge

A descriptor of either an edge in a rule, or a null edge.

3.2.15.5.4.2.1. Synopsis

Edge()
explicit operator bool() const
bool isNull() const
std::shared_ptr<Rule> getGraph() const
std::shared_ptr<Rule> getRule() const
LeftGraph::Edge getLeft() const
ContextGraph::Edge getContext() const
RightGraph::Edge getRight() const
Vertex source() const
Vertex target() const

3.2.15.5.4.2.2. Details

Edge()

Constructs a null descriptor.

explicit operator bool() const
Returns

!isNull()

bool isNull() const
Returns

whether this is a null descriptor or not.

std::shared_ptr<Rule> getGraph() const
std::shared_ptr<Rule> getRule() const
Returns

the rule the edge belongs to, which happens to be the rule object it self.

Throws

LogicError if it is a null descriptor.

LeftGraph::Edge getLeft() const
Returns

a null descriptor if this edge is not in the left graph, otherwise the descriptor of this edge in the left graph.

ContextGraph::Edge getContext() const
Returns

a null descriptor if this edge is not in the context graph, otherwise the descriptor of this edge in the context graph.

RightGraph::Edge getRight() const
Returns

a null descriptor if this edge is not in the right graph, otherwise the descriptor of this edge in the right graph.

Vertex source() const
Returns

the source vertex of the edge.

Throws

LogicError if it is a null descriptor.

Vertex target() const
Returns

the target vertex of the edge.

Throws

LogicError if it is a null descriptor.

3.2.15.5.4.3. Class rule::Rule::VertexIterator

class rule::Rule::VertexIterator

An iterator for traversing all vertices in a rule. It models a forward iterator.

3.2.15.5.4.3.1. Synopsis

VertexIterator()

3.2.15.5.4.3.2. Details

VertexIterator()

Construct a past-the-end iterator.

3.2.15.5.4.4. Class rule::Rule::VertexRange

class rule::Rule::VertexRange

A range of all vertices in a rule.

3.2.15.5.4.4.1. Synopsis

3.2.15.5.4.5. Class rule::Rule::EdgeIterator

class rule::Rule::EdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

3.2.15.5.4.5.1. Synopsis

EdgeIterator()

3.2.15.5.4.5.2. Details

EdgeIterator()

Construct a past-the-end iterator.

3.2.15.5.4.6. Class rule::Rule::EdgeRange

class rule::Rule::EdgeRange

A range of all edges in a rule.

3.2.15.5.4.6.1. Synopsis

3.2.15.5.4.7. Class rule::Rule::IncidnetEdgeIterator

class rule::Rule::IncidnetEdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

3.2.15.5.4.7.1. Synopsis

IncidentEdgeIterator()

3.2.15.5.4.7.2. Details

IncidentEdgeIterator()

Construct a past-the-end iterator.

3.2.15.5.4.8. Class rule::Rule::IncidentEdgeRange

class rule::Rule::IncidentEdgeRange

A range of all incident edges to a vertex in a rule.

3.2.15.5.4.8.1. Synopsis