indigoX
|
Class containing a graph representation of a molecule. More...
#include <indigox/graph/molecular.hpp>
Public Types | |
using | AtomMap = eastl::vector_map< Atom, MGVertex > |
Container for mapping atoms to vertices. More... | |
using | BondMap = eastl::vector_map< Bond, MGEdge > |
Container for mapping bonds to edges. More... | |
using | ComponentContain = std::vector< VertContain > |
Type for storing components. More... | |
using | CycleEdgeContain = std::vector< EdgeContain > |
Type for storing edge cycles. More... | |
using | CycleVertContain = std::vector< VertContain > |
Type for storing vertex cycles. More... | |
using | EdgeContain = std::vector< MGEdge > |
Container for edges. More... | |
using | EdgeIter = EdgeContain::const_iterator |
Type of the iterator returned by GetEdges() method. More... | |
using | EdgeMap = indigox::utils::SimpleBiMap< MGEdge, EdgeType > |
Type for bidirectional mapping of E to edge descriptor type. More... | |
using | EdgeType = MGEdge |
Type used for edges. More... | |
using | graph_type = BaseGraph< MGVertex, MGEdge, MolecularGraph > |
Type of the underlying IXGraphBase. More... | |
using | NbrsContain = std::map< MGVertex, VertContain > |
Container for neighbours of vertices. More... | |
using | NbrsIter = NbrsContain::mapped_type::const_iterator |
Type of the iterator returned by GetNeighbours() method. More... | |
using | PredIter = typename graph_type::inv_adjacency_iterator |
Type for iterator over predecessors of a vertex descriptor. More... | |
using | SubgraphType = MolecularGraph |
using | VertContain = std::vector< MGVertex > |
Container for vertices. More... | |
using | VertexType = MGVertex |
Type used for vertices. More... | |
using | VertIter = VertContain::const_iterator |
Type of the iterator returned by GetVertices() method. More... | |
using | VertMap = indigox::utils::SimpleBiMap< MGVertex, VertType > |
Type for bidirectional mapping of V to vertex descriptor type. More... | |
using | VertType = typename graph_type::vertex_descriptor |
Type of the graph vertex descriptor. More... | |
Public Member Functions | |
MolecularGraph ()=default | |
Construct with a molecule. More... | |
MolecularGraph (const MolecularGraph &)=default | |
MolecularGraph (MolecularGraph &&)=default | |
MolecularGraph (const Molecule &mol) | |
~ MolecularGraph ()=default | |
int64_t | Degree (const MGVertex &v) const |
Degree of a vertex. More... | |
const CondensedMolecularGraph & | GetCondensedGraph () |
const ComponentContain & | GetConnectedComponents () |
Get the connected components of the graph. More... | |
const CycleEdgeContain & | GetCycles () |
Get the cycles of the graph. More... | |
const MGEdge & | GetEdge (const Bond &bnd) const |
Get the edge associated with a bond. More... | |
MGEdge | GetEdge (const MGVertex &u, const MGVertex &v) const |
Get the edge between two vertices. More... | |
const EdgeContain & | GetEdges () const |
Get the edges of the graph. More... | |
const Molecule & | GetMolecule () const |
const VertContain & | GetNeighbours (const MGVertex &v) |
Get the neighbouring vertices of a vertex. More... | |
const VertContain & | GetPredecessors (const MGVertex &v) |
Get the predecessor vertices of a vertex. More... | |
MGVertex | GetSourceVertex (const MGEdge &e) const |
Get the source vertex of an edge. More... | |
const VertContain & | GetSuccessors (const MGVertex &v) |
const MolecularGraph & | GetSuperGraph () const |
MGVertex | GetTargetVertex (const MGEdge &e) const |
Get the target vertex of an edge. More... | |
const MGVertex & | GetVertex (const Atom &atm) const |
Get the vertex associated with an atom. More... | |
std::pair< MGVertex, MGVertex > | GetVertices (const MGEdge &e) const |
Get the two vertices that make up an edge. More... | |
const VertContain & | GetVertices () const |
Get the vertices of the graph. More... | |
bool | HasEdge (const MGEdge &e) const |
Is the edge in the graph. More... | |
bool | HasEdge (const MGVertex &u, const MGVertex &v) const |
Does an edge exist between two vertices. More... | |
bool | HasEdge (const Bond &e) const |
Check if the graph has an edge associated with a bond. More... | |
bool | HasVertex (const MGVertex &v) const |
Is the vertex in the graph. More... | |
bool | HasVertex (const Atom &v) const |
Check if the graph has a vertex associated with an atom. More... | |
int64_t | InDegree (const MGVertex &v) const |
Indegree of a vertex. More... | |
bool | IsConnected () |
Determine if the graph is connected. More... | |
bool | IsCyclic (const MGVertex &v) |
Determine if a vertex of this graph is cyclic. More... | |
bool | IsCyclic (const MGVertex &v, uint32_t sz) |
bool | IsCyclic (const MGEdge &e) |
Determine if an edge of this graph is cycle. More... | |
bool | IsCyclic (const MGEdge &e, uint32_t sz) |
bool | IsSubgraph () const |
int64_t | NumConnectedComponents () |
Get the number of connected components of the graph. More... | |
int64_t | NumCycles () |
int64_t | NumEdges () const |
Number of edges in the graph. More... | |
int64_t | NumVertices () const |
Number of vertices in the graph. More... | |
operator bool () const | |
bool | operator!= (const MolecularGraph &g) const |
bool | operator< (const MolecularGraph &g) const |
bool | operator<= (const MolecularGraph &g) const |
MolecularGraph & | operator= (MolecularGraph &&)=default |
MolecularGraph & | operator= (const MolecularGraph &)=default |
bool | operator== (const MolecularGraph &g) const |
bool | operator> (const MolecularGraph &g) const |
bool | operator>= (const MolecularGraph &g) const |
MolecularGraph | Subgraph (std::vector< MGVertex > &vertices) |
Induce a subgraph from the range of vertices. More... | |
MolecularGraph | Subgraph (std::vector< MGVertex > &vertices, std::vector< MGEdge > &edges) |
Protected Member Functions | |
void | AddEdge (const MGVertex &u, const MGVertex &v, const MGEdge &e) |
Add a new edge to the graph. More... | |
void | AddVertex (const MGVertex &v) |
Add a new vertex to the graph. More... | |
Protected Attributes | |
std::shared_ptr< BaseImpl > | m_basedata |
Friends | |
class | cereal::access |
Friendship allows serialisation. More... | |
class | indigox::Molecule |
Friendship allows an Molecule to own a graph. More... | |
std::ostream & | operator<< (std::ostream &os, const MolecularGraph &g) |
Class containing a graph representation of a molecule.
The IXMolecularGraph is designed to be maintained by the IXMolecule instance owning it. To that end, all the modifying methods assume that the parameters feed to them are valid. However, all the accessing methods do not make this assumption and so perform sanity checks.
|
inherited |
Type for storing components.
|
inherited |
Type for storing edge cycles.
|
inherited |
Type for storing vertex cycles.
using EdgeContain = std::vector<MGEdge> |
Container for edges.
using EdgeIter = EdgeContain::const_iterator |
Type of the iterator returned by GetEdges() method.
|
inherited |
Type for bidirectional mapping of E to edge descriptor type.
using graph_type = BaseGraph<MGVertex, MGEdge, MolecularGraph> |
Type of the underlying IXGraphBase.
using NbrsContain = std::map<MGVertex, VertContain> |
Container for neighbours of vertices.
using NbrsIter = NbrsContain::mapped_type::const_iterator |
Type of the iterator returned by GetNeighbours() method.
|
inherited |
Type for iterator over predecessors of a vertex descriptor.
|
inherited |
using VertContain = std::vector<MGVertex> |
Container for vertices.
using VertexType = MGVertex |
Type used for vertices.
using VertIter = VertContain::const_iterator |
Type of the iterator returned by GetVertices() method.
|
inherited |
Type for bidirectional mapping of V to vertex descriptor type.
|
inherited |
Type of the graph vertex descriptor.
|
default |
Construct with a molecule.
mol | the molecule to reference to. |
|
default |
|
default |
|
default |
MolecularGraph | ( | const Molecule & | mol | ) |
Add a new edge to the graph.
Vertex u is used as the source and vertex v as the target. If u and/or v are not already part of the graph, they are added. It is the callers responsibility to ensure that the edge is not part of the graph.
u,v | vertices the edge is between. |
e | the edge. |
|
protectedinherited |
Add a new vertex to the graph.
It is the callers responsability to ensure that the vertex added is not already part of the graph. If it is, a mismatch between the vertices in the graph and the what the _verts member thinks are in the graph may arise.
v | the vertex to add. |
|
inherited |
Degree of a vertex.
In the case of a directed graph, the degree of a vertex is the number of edges leaving the vertex.
v | the vertex to get the degree of. |
const CondensedMolecularGraph& GetCondensedGraph | ( | ) |
|
inherited |
Get the connected components of the graph.
|
inherited |
Get the cycles of the graph.
Get the edge associated with a bond.
If the bond is not associated with an edge on this graph, the returned edge is null.
bnd | the bond to get the associated edge of. |
Get the edge between two vertices.
It is the callers responsibilty to ensure that the vertices are a part of the graph.
u,v | vertices to get the edge between. |
|
inherited |
Get the edges of the graph.
[out] | edges | the vector where the list of edges will be set. The vector is cleared before any edges are added to it. |
const Molecule& GetMolecule | ( | ) | const |
|
inherited |
Get the neighbouring vertices of a vertex.
The neighbours of a vertex are those for which the edge v -> u exists within the graph. It is the callers responsibilty to ensure that the vertex is a part of the graph.
v | the vertex to get the neighbours of. | |
[out] | nbrs | the vector where the list of neighbours will be set. The vector is cleared before any neighbouring vertices are added to it. |
|
inherited |
Get the predecessor vertices of a vertex.
The predecessors of a vertex are those for which the edge u -> v exists within the graph. For an undirected graph, this is equivalent to the neighbours. It is the callers responsibilty to ensure that the vertex is a part of the graph.
[in] | v | the vertex to get the predecessors of. |
[out] | pres | the vector where the list of predecessors will be set. The vector is cleared before any predecessing vertices are added to it. |
Get the source vertex of an edge.
It is the callers responsibilty to ensure that the edge is a part of the graph.
e | the edge to get the source of. |
|
inherited |
const MolecularGraph& GetSuperGraph | ( | ) | const |
Get the target vertex of an edge.
It is the callers responsibilty to ensure that the edge is a part of the graph.
e | the edge to get the target of. |
Get the vertex associated with an atom.
If the atom is not associated with a vertex of this graph, the returned vertex is null.
atm | the atom to get the assocaited vertex of. |
Get the two vertices that make up an edge.
It is the callers responsibility to ensure that the edge is a part of the graph.
e | the edge to get vertices of. |
|
inherited |
Get the vertices of the graph.
[out] | verts | the vector where the list of vertices will be set. The vector is cleared before any vertices are added to it. |
|
inherited |
Is the edge in the graph.
e | edge to search for. |
Does an edge exist between two vertices.
u,v | vertices to check between. |
bool HasEdge | ( | const Bond & | e | ) | const |
Check if the graph has an edge associated with a bond.
e | the bond to check for. |
|
inherited |
Is the vertex in the graph.
v | vertex to search for. |
bool HasVertex | ( | const Atom & | v | ) | const |
Check if the graph has a vertex associated with an atom.
v | that atom to check for. |
|
inherited |
Indegree of a vertex.
The indegree of a vertex is the number of edges entering the vertex. For an undirected graph, this is equivalent to Degree(V) const. It is the callers responsibilty to ensure that the vertex is a part of the graph.
v | the vertex to get indegree of. |
|
inherited |
Determine if the graph is connected.
|
inherited |
Determine if a vertex of this graph is cyclic.
v | the vertex to check if in a cycle |
|
inherited |
|
inherited |
Determine if an edge of this graph is cycle.
e | the edge to check if in a cycle. |
|
inherited |
bool IsSubgraph | ( | ) | const |
|
inherited |
Get the number of connected components of the graph.
|
inherited |
|
inherited |
Number of edges in the graph.
|
inherited |
Number of vertices in the graph.
|
inline |
|
inline |
bool operator< | ( | const MolecularGraph & | g | ) | const |
|
inline |
|
default |
|
default |
bool operator== | ( | const MolecularGraph & | g | ) | const |
bool operator> | ( | const MolecularGraph & | g | ) | const |
|
inline |
|
virtual |
Induce a subgraph from the range of vertices.
Induced subgraph has the same vertices and edges as its parent graph. Additionally, its source Molecule is the same. This is a vertex induced subgraph, meaning that all edges where both vertices are in the provided range will be in the induced graph.
InputIt | type of the iterator range provided. |
begin,end | marking the range of vertices to induce subgraph on. |
Implements BaseGraph< MGVertex, MGEdge, MolecularGraph >.
|
virtual |
Implements BaseGraph< MGVertex, MGEdge, MolecularGraph >.
|
friend |
Friendship allows serialisation.
|
friend |
Friendship allows an Molecule to own a graph.
|
friend |
|
protectedinherited |