indigoX
CondensedMolecularGraph Class Reference

#include <indigox/graph/condensed.hpp>

+ Inheritance diagram for CondensedMolecularGraph:
+ Collaboration diagram for CondensedMolecularGraph:

Public Types

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< CMGEdge >
 Container for edges. More...
 
using EdgeIter = EdgeContain::const_iterator
 Type of the iterator returned by GetEdges() method. More...
 
using EdgeMap = eastl::vector_map< MGEdge, CMGEdge >
 Container for mapping MGEdge to edges. More...
 
using EdgeType = CMGEdge
 Type used for edges. More...
 
using graph_type = BaseGraph< CMGVertex, CMGEdge, CondensedMolecularGraph >
 Type of the underlying IXGraphBase. More...
 
using NbrsContain = std::map< CMGVertex, 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 = CondensedMolecularGraph
 
using VertContain = std::vector< CMGVertex >
 Container for vertices. More...
 
using VertexType = CMGVertex
 Type used for vertices. More...
 
using VertIter = VertContain::const_iterator
 Type of the iterator returned by GetVertices() method. More...
 
using VertMap = eastl::vector_map< MGVertex, CMGVertex >
 Container for mapping MGVertex to vertices. More...
 
using VertType = typename graph_type::vertex_descriptor
 Type of the graph vertex descriptor. More...
 

Public Member Functions

 CondensedMolecularGraph ()=default
 
 CondensedMolecularGraph (const CondensedMolecularGraph &)=default
 
 CondensedMolecularGraph (CondensedMolecularGraph &&)=default
 
 ~ CondensedMolecularGraph ()=default
 
int64_t Degree (const CMGVertex &v) const
 Degree of a vertex. More...
 
const CMGVertexGetCondensedVertex (const MGVertex &v) const
 
const ComponentContainGetConnectedComponents ()
 Get the connected components of the graph. More...
 
const CycleEdgeContainGetCycles ()
 Get the cycles of the graph. More...
 
const CMGEdgeGetEdge (const MGEdge &e) const
 Get the edge associated with an MGEdge. More...
 
CMGEdge GetEdge (const CMGVertex &u, const CMGVertex &v) const
 Get the edge between two vertices. More...
 
const EdgeContainGetEdges () const
 Get the edges of the graph. More...
 
const MolecularGraphGetMolecularGraph () const
 Get the source MolecularGraph. More...
 
const VertContainGetNeighbours (const CMGVertex &v)
 Get the neighbouring vertices of a vertex. More...
 
const VertContainGetPredecessors (const CMGVertex &v)
 Get the predecessor vertices of a vertex. More...
 
CMGVertex GetSourceVertex (const CMGEdge &e) const
 Get the source vertex of an edge. More...
 
const VertContainGetSuccessors (const CMGVertex &v)
 
const CondensedMolecularGraphGetSuperGraph () const
 
CMGVertex GetTargetVertex (const CMGEdge &e) const
 Get the target vertex of an edge. More...
 
const CMGVertexGetVertex (const MGVertex &v) const
 Get the vertex associated with an MGVertex. More...
 
std::pair< CMGVertex, CMGVertexGetVertices (const CMGEdge &e) const
 Get the two vertices that make up an edge. More...
 
const VertContainGetVertices () const
 Get the vertices of the graph. More...
 
bool HasCondensedVertex (const MGVertex &v) const
 Check of the graph has a vertex associated with an MGVertex. More...
 
bool HasEdge (const CMGEdge &e) const
 Is the edge in the graph. More...
 
bool HasEdge (const CMGVertex &u, const CMGVertex &v) const
 Does an edge exist between two vertices. More...
 
bool HasEdge (const MGEdge &e) const
 Check if the graph has an edge associated with an MGEdge. More...
 
bool HasVertex (const CMGVertex &v) const
 Is the vertex in the graph. More...
 
bool HasVertex (const MGVertex &v) const
 Check if the graph has a vertex directly associated with an MGVertex. More...
 
int64_t InDegree (const CMGVertex &v) const
 Indegree of a vertex. More...
 
bool IsConnected ()
 Determine if the graph is connected. More...
 
bool IsCyclic (const CMGVertex &v)
 Determine if a vertex of this graph is cyclic. More...
 
bool IsCyclic (const CMGVertex &v, uint32_t sz)
 
bool IsCyclic (const CMGEdge &e)
 Determine if an edge of this graph is cycle. More...
 
bool IsCyclic (const CMGEdge &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 CondensedMolecularGraph &G) const
 
bool operator< (const CondensedMolecularGraph &G) const
 
bool operator<= (const CondensedMolecularGraph &G) const
 
CondensedMolecularGraphoperator= (const CondensedMolecularGraph &)=default
 
CondensedMolecularGraphoperator= (CondensedMolecularGraph &&)=default
 
bool operator== (const CondensedMolecularGraph &G) const
 
bool operator> (const CondensedMolecularGraph &G) const
 
bool operator>= (const CondensedMolecularGraph &G) const
 
CondensedMolecularGraph Subgraph (std::vector< CMGVertex > &verts)
 Induce a subgraph from the range of vertices. More...
 
CondensedMolecularGraph Subgraph (std::vector< CMGVertex > &verts, std::vector< CMGEdge > &edges)
 Create a subgraph from the range of vertices and edges. More...
 

Protected Member Functions

void AddEdge (const CMGVertex &u, const CMGVertex &v, const CMGEdge &e)
 Add a new edge to the graph. More...
 
void AddVertex (const CMGVertex &v)
 Add a new vertex to the graph. More...
 
void RemoveEdge (const CMGEdge &e)
 Remove an edge from the graph. More...
 
void RemoveEdge (const CMGVertex &u, const CMGVertex &v)
 Remove an edge from the graph. More...
 
void RemoveVertex (const CMGVertex &v)
 Remove a vertex from the graph. More...
 

Protected Attributes

std::shared_ptr< BaseImpl > m_basedata
 

Friends

class cereal::access
 Friendship allows serialisation. More...
 
CondensedMolecularGraph Condense (const MolecularGraph &)
 Friendship allows for generating from a source. More...
 
class MolecularGraph
 
std::ostream & operator<< (std::ostream &os, const CondensedMolecularGraph &G)
 

Member Typedef Documentation

◆ ComponentContain

using ComponentContain = std::vector<VertContain>
inherited

Type for storing components.

◆ CycleEdgeContain

using CycleEdgeContain = std::vector<EdgeContain>
inherited

Type for storing edge cycles.

◆ CycleVertContain

using CycleVertContain = std::vector<VertContain>
inherited

Type for storing vertex cycles.

◆ EdgeContain

using EdgeContain = std::vector<CMGEdge>

Container for edges.

◆ EdgeIter

using EdgeIter = EdgeContain::const_iterator

Type of the iterator returned by GetEdges() method.

◆ EdgeMap

using EdgeMap = eastl::vector_map<MGEdge, CMGEdge>

Container for mapping MGEdge to edges.

◆ EdgeType

using EdgeType = CMGEdge

Type used for edges.

◆ graph_type

Type of the underlying IXGraphBase.

◆ NbrsContain

using NbrsContain = std::map<CMGVertex, VertContain>

Container for neighbours of vertices.

◆ NbrsIter

using NbrsIter = NbrsContain::mapped_type::const_iterator

Type of the iterator returned by GetNeighbours() method.

◆ PredIter

using PredIter = typename graph_type::inv_adjacency_iterator
inherited

Type for iterator over predecessors of a vertex descriptor.

◆ SubgraphType

◆ VertContain

using VertContain = std::vector<CMGVertex>

Container for vertices.

◆ VertexType

Type used for vertices.

◆ VertIter

using VertIter = VertContain::const_iterator

Type of the iterator returned by GetVertices() method.

◆ VertMap

using VertMap = eastl::vector_map<MGVertex, CMGVertex>

Container for mapping MGVertex to vertices.

◆ VertType

using VertType = typename graph_type::vertex_descriptor
inherited

Type of the graph vertex descriptor.

Constructor & Destructor Documentation

◆ CondensedMolecularGraph() [1/3]

◆ CondensedMolecularGraph() [2/3]

◆ CondensedMolecularGraph() [3/3]

◆ ~ CondensedMolecularGraph()

~ CondensedMolecularGraph ( )
default

Member Function Documentation

◆ AddEdge()

void AddEdge ( const CMGVertex u,
const CMGVertex v,
const CMGEdge e 
)
protectedinherited

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.

Parameters
u,vvertices the edge is between.
ethe edge.

◆ AddVertex()

void AddVertex ( const CMGVertex v)
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.

Parameters
vthe vertex to add.

◆ Degree()

int64_t Degree ( const CMGVertex v) const
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.

Parameters
vthe vertex to get the degree of.
Returns
pair of the degree of the vertex and if it is valid.

◆ GetCondensedVertex()

const CMGVertex& GetCondensedVertex ( const MGVertex v) const

◆ GetConnectedComponents()

const BaseGraph< CMGVertex , CMGEdge , CondensedMolecularGraph , Undirected , GraphLabel , GraphLabel >::ComponentContain & GetConnectedComponents ( )
inherited

Get the connected components of the graph.

Returns
reference to the connected components of the graph.

◆ GetCycles()

Get the cycles of the graph.

Returns
the cycles of the graph.

◆ GetEdge() [1/2]

const CMGEdge& GetEdge ( const MGEdge e) const

Get the edge associated with an MGEdge.

If the edge is not associated with an edge on this graph, the returned edge is null.

Parameters
ethe edge to get the associated edge of.
Returns
the associated edge.

◆ GetEdge() [2/2]

CMGEdge GetEdge ( const CMGVertex u,
const CMGVertex v 
) const
inherited

Get the edge between two vertices.

It is the callers responsibilty to ensure that the vertices are a part of the graph.

Parameters
u,vvertices to get the edge between.
Returns
a pair of the edge between the two vertces and if it is valid.

◆ GetEdges()

const BaseGraph< CMGVertex , CMGEdge , CondensedMolecularGraph , Undirected , GraphLabel , GraphLabel >::EdgeContain & GetEdges ( ) const
inherited

Get the edges of the graph.

Parameters
[out]edgesthe vector where the list of edges will be set. The vector is cleared before any edges are added to it.
Returns
the number of edges added to the vector.

◆ GetMolecularGraph()

const MolecularGraph& GetMolecularGraph ( ) const

Get the source MolecularGraph.

Returns
the molecular graph used to construt this.

◆ GetNeighbours()

const BaseGraph< CMGVertex , CMGEdge , CondensedMolecularGraph , Undirected , GraphLabel , GraphLabel >::VertContain & GetNeighbours ( const CMGVertex v)
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.

Parameters
vthe vertex to get the neighbours of.
[out]nbrsthe vector where the list of neighbours will be set. The vector is cleared before any neighbouring vertices are added to it.
Returns
if the vector has been populated or not.

◆ GetPredecessors()

const BaseGraph< CMGVertex , CMGEdge , CondensedMolecularGraph , Undirected , GraphLabel , GraphLabel >::VertContain & GetPredecessors ( const CMGVertex v)
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.

Parameters
[in]vthe vertex to get the predecessors of.
[out]presthe vector where the list of predecessors will be set. The vector is cleared before any predecessing vertices are added to it.
Returns
if the vector has been populated or not.

◆ GetSourceVertex()

CMGVertex GetSourceVertex ( const CMGEdge e) const
inherited

Get the source vertex of an edge.

It is the callers responsibilty to ensure that the edge is a part of the graph.

Parameters
ethe edge to get the source of.
Returns
a pair of the source vertex of the edge and if it is valid.

◆ GetSuccessors()

const BaseGraph< CMGVertex , CMGEdge , CondensedMolecularGraph , Undirected , GraphLabel , GraphLabel >::VertContain & GetSuccessors ( const CMGVertex v)
inherited

◆ GetSuperGraph()

const CondensedMolecularGraph& GetSuperGraph ( ) const

◆ GetTargetVertex()

CMGVertex GetTargetVertex ( const CMGEdge e) const
inherited

Get the target vertex of an edge.

It is the callers responsibilty to ensure that the edge is a part of the graph.

Parameters
ethe edge to get the target of.
Returns
the target vertex of the edge.

◆ GetVertex()

const CMGVertex& GetVertex ( const MGVertex v) const

Get the vertex associated with an MGVertex.

If the vertex is not associated with a vertex of this graph, the returned vertex is null.

Parameters
vthe MGVertex to get the assocaited vertex of.
Returns
the associated vertex.

◆ GetVertices() [1/2]

std::pair< CMGVertex , CMGVertex > GetVertices ( const CMGEdge e) const
inherited

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.

Parameters
ethe edge to get vertices of.
Returns
a pair of a pair of the two vertices making up the edge and if they are valid.

◆ GetVertices() [2/2]

const BaseGraph< CMGVertex , CMGEdge , CondensedMolecularGraph , Undirected , GraphLabel , GraphLabel >::VertContain & GetVertices ( ) const
inherited

Get the vertices of the graph.

Parameters
[out]vertsthe vector where the list of vertices will be set. The vector is cleared before any vertices are added to it.
Returns
the number of vertices added to the vector.

◆ HasCondensedVertex()

bool HasCondensedVertex ( const MGVertex v) const

Check of the graph has a vertex associated with an MGVertex.

Association in this case includes a vertex where one of the condensed vertices is the provided vertex.

Parameters
vthe vertex to check for.
Returns
if the vertex is associated with the graph or not.

◆ HasEdge() [1/3]

bool HasEdge ( const CMGEdge e) const
inherited

Is the edge in the graph.

Parameters
eedge to search for.
Returns
if the requested edge is contained in the graph or not.

◆ HasEdge() [2/3]

bool HasEdge ( const CMGVertex u,
const CMGVertex v 
) const
inherited

Does an edge exist between two vertices.

Parameters
u,vvertices to check between.
Returns
if there is an edge between the two vertices.

◆ HasEdge() [3/3]

bool HasEdge ( const MGEdge e) const

Check if the graph has an edge associated with an MGEdge.

Parameters
ethe edge to check for.
Returns
if the edge is associated with the graph or not.

◆ HasVertex() [1/2]

bool HasVertex ( const CMGVertex v) const
inherited

Is the vertex in the graph.

Parameters
vvertex to search for.
Returns
if the requested vertex is contained in the graph or not.

◆ HasVertex() [2/2]

bool HasVertex ( const MGVertex v) const

Check if the graph has a vertex directly associated with an MGVertex.

Directly associated means that the vertex cannot be condensed into another vertex.

Parameters
vthe vertex to check for.
Returns
if the vertex is directly associated with the graph or not.

◆ InDegree()

int64_t InDegree ( const CMGVertex v) const
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.

Parameters
vthe vertex to get indegree of.
Returns
pair of the indegree of the vertex and if it is valid.

◆ IsConnected()

bool IsConnected ( )
inherited

Determine if the graph is connected.

Returns
if the graph is connected or not.

◆ IsCyclic() [1/4]

bool IsCyclic ( const CMGVertex v)
inherited

Determine if a vertex of this graph is cyclic.

Parameters
vthe vertex to check if in a cycle
Returns
if the vertex is in a cycle or not.

◆ IsCyclic() [2/4]

bool IsCyclic ( const CMGVertex v,
uint32_t  sz 
)
inherited

◆ IsCyclic() [3/4]

bool IsCyclic ( const CMGEdge e)
inherited

Determine if an edge of this graph is cycle.

Parameters
ethe edge to check if in a cycle.
Returns
if the edge is in a cycle or not.

◆ IsCyclic() [4/4]

bool IsCyclic ( const CMGEdge e,
uint32_t  sz 
)
inherited

◆ IsSubgraph()

bool IsSubgraph ( ) const

◆ NumConnectedComponents()

int64_t NumConnectedComponents ( )
inherited

Get the number of connected components of the graph.

Returns
the number of cnnected components of the graph.

◆ NumCycles()

int64_t NumCycles ( )
inherited

◆ NumEdges()

int64_t NumEdges ( ) const
inherited

Number of edges in the graph.

Returns
the number of edges in the graph.

◆ NumVertices()

int64_t NumVertices ( ) const
inherited

Number of vertices in the graph.

Returns
the number of vertices in the graph.

◆ operator bool()

operator bool ( ) const
inline

◆ operator!=()

bool operator!= ( const CondensedMolecularGraph G) const
inline

◆ operator<()

bool operator< ( const CondensedMolecularGraph G) const

◆ operator<=()

bool operator<= ( const CondensedMolecularGraph G) const
inline

◆ operator=() [1/2]

CondensedMolecularGraph& operator= ( const CondensedMolecularGraph )
default

◆ operator=() [2/2]

CondensedMolecularGraph& operator= ( CondensedMolecularGraph &&  )
default

◆ operator==()

bool operator== ( const CondensedMolecularGraph G) const

◆ operator>()

bool operator> ( const CondensedMolecularGraph G) const

◆ operator>=()

bool operator>= ( const CondensedMolecularGraph G) const
inline

◆ RemoveEdge() [1/2]

void RemoveEdge ( const CMGEdge e)
protectedinherited

Remove an edge from the graph.

It is the callers responsibility to ensure that the edge is a part of the graph.

Parameters
ethe edge to remove.

◆ RemoveEdge() [2/2]

void RemoveEdge ( const CMGVertex u,
const CMGVertex v 
)
protectedinherited

Remove an edge from the graph.

It is the callers responsibility to ensure that there is an edge between u and v to remove.

Parameters
u,vvertices to remove an edge from between.

◆ RemoveVertex()

void RemoveVertex ( const CMGVertex v)
protectedinherited

Remove a vertex from the graph.

Removing a vertex also removes all edges incident on it. It is the callers responsibility to ensure that the vertex removed is within the graph.

Parameters
vthe vertex to remove.

◆ Subgraph() [1/2]

CondensedMolecularGraph Subgraph ( std::vector< CMGVertex > &  verts)
virtual

Induce a subgraph from the range of vertices.

Induced subgraph has the same vertices and edges as its parent graph. Additionally, its source MolecularGraph 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.

Template Parameters
InputIttype of the iterator range provided.
Parameters
begin,endmarking the range of vertices to induce subgraph on.
Returns
a new CondensedMolecularGraph.

Implements BaseGraph< CMGVertex, CMGEdge, CondensedMolecularGraph >.

◆ Subgraph() [2/2]

CondensedMolecularGraph Subgraph ( std::vector< CMGVertex > &  verts,
std::vector< CMGEdge > &  edges 
)
virtual

Create a subgraph from the range of vertices and edges.

Subgraph has the same vertices and edges as its parent graph. Additionally, its source MolecularGraph is the same. This subgraph is such that only edges within the provided range are added to it, as long as both vertices are in the provided vertex range.

Template Parameters
VertIttype of the vertex iterator range provided.
EdgeIttype of the edge iterator range provided.
Parameters
v_begin,v_endmarking the range of vertices to create subgraph.
e_begin,e_endmarking the range of edges to include in subgraph.
Returns
a new CondensedMolecularGraph.

Implements BaseGraph< CMGVertex, CMGEdge, CondensedMolecularGraph >.

Friends And Related Function Documentation

◆ cereal::access

friend class cereal::access
friend

Friendship allows serialisation.

◆ Condense

CondensedMolecularGraph Condense ( const MolecularGraph )
friend

Friendship allows for generating from a source.

◆ MolecularGraph

friend class MolecularGraph
friend

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const CondensedMolecularGraph G 
)
friend

Member Data Documentation

◆ m_basedata

std::shared_ptr<BaseImpl> m_basedata
protectedinherited

The documentation for this class was generated from the following file: