2.2.12.4. graph/GraphInterface.hpp¶
This header contains the definitions for the graph interface for graph::Graph
.
2.2.12.4.1. Class graph::Graph::Vertex
¶
2.2.12.4.1.1. Synopsis¶
struct MOD_DECL Graph::Vertex {
Vertex(std::shared_ptr<Graph> g, std::size_t vId);
public:
Vertex();
MOD_DECL friend std::ostream &operator<<(std::ostream &s, const Vertex &v);
MOD_DECL friend bool operator==(const Vertex &v1, const Vertex &v2);
MOD_DECL friend bool operator!=(const Vertex &v1, const Vertex &v2);
MOD_DECL friend bool operator<(const Vertex &v1, const Vertex &v2);
std::size_t hash() const;
explicit operator bool() const;
bool isNull() const;
std::size_t getId() const;
std::shared_ptr<Graph> 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;
private:
std::shared_ptr<Graph> g;
std::size_t vId;
};
2.2.12.4.1.2. Details¶
-
Vertex
()¶ Constructs a null descriptor.
-
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<Graph>
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 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.
2.2.12.4.2. Class graph::Graph::Edge
¶
2.2.12.4.2.1. Synopsis¶
class MOD_DECL Graph::Edge {
friend class EdgeIterator;
friend class IncidentEdgeIterator;
Edge(std::shared_ptr<Graph> g, std::size_t vId, std::size_t eId);
public:
Edge();
MOD_DECL friend std::ostream &operator<<(std::ostream &s, const Edge &e);
MOD_DECL friend bool operator==(const Edge &e1, const Edge &e2);
MOD_DECL friend bool operator!=(const Edge &e1, const Edge &e2);
MOD_DECL friend bool operator<(const Edge &e1, const Edge &e2);
explicit operator bool() const;
bool isNull() const;
std::shared_ptr<Graph> getGraph() const;
Vertex source() const;
Vertex target() const;
const std::string &getStringLabel() const;
BondType getBondType() const;
private:
std::shared_ptr<Graph> g;
std::size_t vId, eId;
};
2.2.12.4.2.2. Details¶
-
Edge
()¶ Constructs a null descriptor.
-
bool
isNull
() const¶ - Returns
whether this is a null descriptor or not.
-
std::shared_ptr<Graph>
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.
2.2.12.4.3. Class graph::Graph::VertexIterator
¶
-
class
graph::Graph
::
VertexIterator
¶ An iterator for traversing all vertices in a graph. It models a forward iterator.
2.2.12.4.3.1. Synopsis¶
class MOD_DECL Graph::VertexIterator
: public boost::iterator_facade<VertexIterator, Vertex, std::forward_iterator_tag, Vertex> {
friend class Graph;
VertexIterator(std::shared_ptr<Graph> g);
public:
VertexIterator();
private:
friend class boost::iterator_core_access;
Vertex dereference() const;
bool equal(const VertexIterator &iter) const;
void increment();
private:
std::shared_ptr<Graph> g;
std::size_t vId;
};
2.2.12.4.4. Class graph::Graph::VertexRange
¶
2.2.12.4.4.1. Synopsis¶
struct Graph::VertexRange {
using iterator = VertexIterator;
using const_iterator = iterator;
private:
friend class Graph;
VertexRange(std::shared_ptr<Graph> g);
public:
VertexIterator begin() const;
VertexIterator end() const;
Vertex operator[](std::size_t i) const;
private:
std::shared_ptr<Graph> g;
};
2.2.12.4.5. Class graph::Graph::EdgeIterator
¶
-
class
graph::Graph
::
EdgeIterator
¶ An iterator for traversing all edges in a graph. It models a forward iterator.
2.2.12.4.5.1. Synopsis¶
class MOD_DECL Graph::EdgeIterator
: public boost::iterator_facade<EdgeIterator, Edge, std::forward_iterator_tag, Edge> {
friend class Graph;
EdgeIterator(std::shared_ptr<Graph> g);
public:
EdgeIterator();
private:
friend class boost::iterator_core_access;
Edge dereference() const;
bool equal(const EdgeIterator &iter) const;
void increment();
void advanceToValid();
private:
std::shared_ptr<Graph> g;
std::size_t vId, eId;
};
2.2.12.4.6. Class graph::Graph::EdgeRange
¶
2.2.12.4.6.1. Synopsis¶
struct Graph::EdgeRange {
using iterator = EdgeIterator;
using const_iterator = iterator;
private:
friend class Graph;
EdgeRange(std::shared_ptr<Graph> g);
public:
EdgeIterator begin() const;
EdgeIterator end() const;
private:
std::shared_ptr<Graph> g;
};
2.2.12.4.7. Class graph::Graph::IncidnetEdgeIterator
¶
-
class
graph::Graph
::
IncidnetEdgeIterator
¶ An iterator for traversing all edges in a graph. It models a forward iterator.
2.2.12.4.7.1. Synopsis¶
class MOD_DECL Graph::IncidentEdgeIterator
: public boost::iterator_facade<IncidentEdgeIterator, Edge, std::forward_iterator_tag, Edge> {
friend class Graph;
IncidentEdgeIterator(std::shared_ptr<Graph> g, std::size_t vId);
public:
IncidentEdgeIterator();
private:
friend class boost::iterator_core_access;
Edge dereference() const;
bool equal(const IncidentEdgeIterator &iter) const;
void increment();
private:
std::shared_ptr<Graph> g;
std::size_t vId, eId;
};
2.2.12.4.8. Class graph::Graph::IncidentEdgeRange
¶
2.2.12.4.8.1. Synopsis¶
struct Graph::IncidentEdgeRange {
using iterator = IncidentEdgeIterator;
using const_iterator = iterator;
private:
friend class Vertex;
IncidentEdgeRange(std::shared_ptr<Graph> g, std::size_t vId);
public:
IncidentEdgeIterator begin() const;
IncidentEdgeIterator end() const;
private:
std::shared_ptr<Graph> g;
std::size_t vId;
};