3.2.12.6. graph/Union.hpp

3.2.12.6.1. Class graph::Union

class graph::Union

An adaptor for a multiset of Graphs to present them as their disjoint union.

3.2.12.6.1.1. Synopsis

type const_iterator
using iterator = const_iterator
Union()
explicit Union(std::vector<std::shared_ptr<Graph>> graphs)
friend std::ostream &operator<<(std::ostream &s, const Union &ug)
std::size_t size() const
const_iterator begin() const
const_iterator end() const
std::shared_ptr<Graph> operator[](std::size_t i) const
std::size_t numVertices() const
VertexRange vertices() const
std::size_t numEdges() const
EdgeRange edges() const
void printTermState() const
class graph::Union::Vertex
class graph::Union::Edge
class graph::Union::VertexIterator
class graph::Union::VertexRange
class graph::Union::EdgeIterator
class graph::Union::EdgeRange
class graph::Union::IncidentEdgeIterator
class graph::Union::IncidentEdgeRange

3.2.12.6.1.2. Details

type const_iterator
using iterator = const_iterator

A random-access iterator over the Graphs adapted by this object.

Union()

Construct an empty graph.

explicit Union(std::vector<std::shared_ptr<Graph>> graphs)

Construct a graph representing the disjoint union of graphs.

Throws:

LogicError – if a given graph is null.

friend std::ostream &operator<<(std::ostream &s, const Union &ug)
std::size_t size() const
Returns:

the number of adapted graphs.

const_iterator begin() const
const_iterator end() const
Returns:

the range of graphs adapted by this object.

std::shared_ptr<Graph> operator[](std::size_t i) const
Returns:

the ith adapted graph.

Throws:

LogicError if i is out of range.

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.

void printTermState() const

Print the term state for the graph.

3.2.12.6.2. Class graph::Union::Vertex

class graph::Union::Vertex

A descriptor of either a vertex in a union graph, or a null vertex.

3.2.12.6.2.1. Synopsis

Vertex()
explicit operator bool() const
bool isNull() const
std::size_t getId() const
Union 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 Printer &p) const
int getGraphIndex() const
int getVertex() const

3.2.12.6.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.

Union getGraph() const
Returns:

the union 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 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.

int getGraphIndex() const
Returns:

The index of the graph in the owning Union graph this vertex is from. The index is thus in the range \([0, len(getGraph())[\).

We can obtain the underlying Graph this vertex is from both directly via getVertex() as getVertex().getGraph(), or via the graph index as getGraph()[getGraphIndex()].

Throws:

LogicError if it is a null descriptor.

int getVertex() const
Returns:

The underlying Graph::Vertex this vertex represents.

We can obtain the underlying Graph this vertex is from both directly via getVertex() as getVertex().getGraph(), or via the graph index as getGraph()[getGraphIndex()].

Throws:

LogicError if it is a null descriptor.

3.2.12.6.3. Class graph::Union::Edge

class graph::Union::Edge

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

3.2.12.6.3.1. Synopsis

Edge()
explicit operator bool() const
bool isNull() const
Union getGraph() const
Vertex source() const
Vertex target() const
const std::string &getStringLabel() const
BondType getBondType() const
int getGraphIndex() const
int getEdge() const

3.2.12.6.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.

Union 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.

int getGraphIndex() const
Returns:

The index of the graph in the owning Union graph this e is from. The index is thus in the range \([0, len(getGraph())[\).

We can obtain the underlying Graph this edge is from both directly via getEdge() as getEdge().getGraph(), or via the graph index as getGraph()[getGraphIndex()].

Throws:

LogicError if it is a null descriptor.

int getEdge() const
Returns:

The underlying Graph::Vertex this vertex represents.

We can obtain the underlying Graph this edge is from both directly via getEdge() as getEdge().getGraph(), or via the graph index as getGraph()[getGraphIndex()].

Throws:

LogicError if it is a null descriptor.

3.2.12.6.4. Class graph::Union::VertexIterator

class graph::Union::VertexIterator

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

3.2.12.6.4.1. Synopsis

VertexIterator()

3.2.12.6.4.2. Details

VertexIterator()

Construct a past-the-end iterator.

3.2.12.6.5. Class graph::Union::VertexRange

class graph::Union::VertexRange

A range of all vertices in a union graph.

3.2.12.6.5.1. Synopsis

3.2.12.6.6. Class graph::Union::EdgeIterator

class graph::Union::EdgeIterator

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

3.2.12.6.6.1. Synopsis

EdgeIterator()

3.2.12.6.6.2. Details

EdgeIterator()

Construct a past-the-end iterator.

3.2.12.6.7. Class graph::Union::EdgeRange

class graph::Union::EdgeRange

A range of all edges in a union graph.

3.2.12.6.7.1. Synopsis

3.2.12.6.8. Class graph::Union::IncidentEdgeIterator

class graph::Union::IncidentEdgeIterator

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

3.2.12.6.8.1. Synopsis

IncidentEdgeIterator()

3.2.12.6.8.2. Details

IncidentEdgeIterator()

Construct a past-the-end iterator.

3.2.12.6.9. Class graph::Union::IncidentEdgeRange

class graph::Union::IncidentEdgeRange

A range of all incident edges to a vertex in a union graph.

3.2.12.6.9.1. Synopsis