Graphitti
A toolkit/software architecture to ease creating high-performance neural network simulators
Loading...
Searching...
No Matches
GraphManager Class Reference

Public Types

using Graph
 Using directive for graphml graph type (adjacency list)
 
using EdgeIterator = typename boost::graph_traits<Graph>::edge_iterator
 
using VertexIterator = typename boost::graph_traits<Graph>::vertex_iterator
 
using EdgeDescriptor = typename boost::graph_traits<Graph>::edge_descriptor
 

Public Member Functions

void setFilePath (string filePath)
 Set the path for the graphML File to be read.
 
template<class Property >
void registerProperty (const string &propName, Property property)
 Registers a graph property with its attribute name in the graphml file.
 
bool readGraph ()
 Loads a graph from a graphml file into a BGL graph.
 
pair< VertexIterator, VertexIterator > vertices ()
 Exposes the BGL Vertex Iterators of the stored Graph.
 
pair< EdgeIterator, EdgeIterator > edges () const
 Exposes the BGL Edge Iterators of the stored Graph.
 
size_t source (const EdgeDescriptor &edge) const
 Retrieves the source vertex index for the given Edge.
 
size_t target (const EdgeDescriptor &edge) const
 Retrieves the target vertex index for the given Edge.
 
VertexPropertyoperator[] (size_t vertex)
 Direct access to the VertexProperty of a vertex descriptor.
 
const VertexPropertyoperator[] (size_t vertex) const
 Direct access to the VertexProperty of a vertex descriptor.
 
const list< EdgeDescriptor > edgesSortByTarget () const
 Returns a list of EdgeDescriptors in ascending order by target vertexID.
 
size_t numVertices () const
 Retrieves the number of vertices in the current graph.
 
size_t numEdges () const
 Retrieves the number of edges in the current graph.
 
 GraphManager (const GraphManager &graphManager)=delete
 Delete copy and move methods to avoid copy instances of the singleton.
 
GraphManageroperator= (const GraphManager &graphManager)=delete
 
 GraphManager (GraphManager &&graphManager)=delete
 
GraphManageroperator= (GraphManager &&graphManager)=delete
 

Static Public Member Functions

static GraphManagergetInstance ()
 Returns a single instance of the GraphManager.
 

Detailed Description

Definition at line 44 of file GraphManager.h.

Member Typedef Documentation

◆ EdgeDescriptor

using GraphManager::EdgeDescriptor = typename boost::graph_traits<Graph>::edge_descriptor

Definition at line 52 of file GraphManager.h.

◆ EdgeIterator

using GraphManager::EdgeIterator = typename boost::graph_traits<Graph>::edge_iterator

Definition at line 50 of file GraphManager.h.

◆ Graph

Initial value:
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, VertexProperty,
The structure to hold the edge properties.
Definition Global.h:269
The structure to hold the Graph properties.
Definition Global.h:274
Struct for vertex attributes.
Definition Global.h:251

Using directive for graphml graph type (adjacency list)

Definition at line 47 of file GraphManager.h.

◆ VertexIterator

using GraphManager::VertexIterator = typename boost::graph_traits<Graph>::vertex_iterator

Definition at line 51 of file GraphManager.h.

Member Function Documentation

◆ edges()

pair< GraphManager::EdgeIterator, GraphManager::EdgeIterator > GraphManager::edges ( ) const

Exposes the BGL Edge Iterators of the stored Graph.

Returns
a pair of EdgeIterators where first points to the beginning and second points to the end of the edges vector

Definition at line 51 of file GraphManager.cpp.

◆ edgesSortByTarget()

const list< GraphManager::EdgeDescriptor > GraphManager::edgesSortByTarget ( ) const

Returns a list of EdgeDescriptors in ascending order by target vertexID.

Returns
List of EdgeDescriptors in ascending order by target vertexID

Definition at line 76 of file GraphManager.cpp.

◆ getInstance()

static GraphManager & GraphManager::getInstance ( )
inlinestatic

Returns a single instance of the GraphManager.

Returns
The single instance of the GraphManager

Definition at line 56 of file GraphManager.h.

◆ numEdges()

size_t GraphManager::numEdges ( ) const

Retrieves the number of edges in the current graph.

Returns
The number of edges in the current graph

Definition at line 97 of file GraphManager.cpp.

◆ numVertices()

size_t GraphManager::numVertices ( ) const

Retrieves the number of vertices in the current graph.

Returns
The number of vertices in the current graph

Definition at line 92 of file GraphManager.cpp.

◆ operator[]() [1/2]

VertexProperty & GraphManager::operator[] ( size_t vertex)

Direct access to the VertexProperty of a vertex descriptor.

Parameters
vertexthe vertex descriptor (index)
Returns
the VertexProperty of the vertex descriptor

Definition at line 66 of file GraphManager.cpp.

◆ operator[]() [2/2]

const VertexProperty & GraphManager::operator[] ( size_t vertex) const

Direct access to the VertexProperty of a vertex descriptor.

Parameters
vertexthe vertex descriptor (index)
Returns
the VertexProperty of the vertex descriptor

Definition at line 71 of file GraphManager.cpp.

◆ readGraph()

bool GraphManager::readGraph ( )

Loads a graph from a graphml file into a BGL graph.

Returns
The graph loaded as an adjacency list

Definition at line 21 of file GraphManager.cpp.

◆ registerProperty()

template<class Property >
void GraphManager::registerProperty ( const string & propName,
Property property )
inline

Registers a graph property with its attribute name in the graphml file.

Note: We are passing a pointer to a data member of the Struct that will hold the property. The BGL will use this when loading the graphML file. Reference: https://www.studytonight.com/cpp/pointer-to-members.php

Template Parameters
PropertyPointer to a Struct data member that will hold the property
Parameters
propNameThe attribute name inthe graphml file
propertyPointer to the property to be registered

Definition at line 75 of file GraphManager.h.

◆ setFilePath()

void GraphManager::setFilePath ( string filePath)

Set the path for the graphML File to be read.

Parameters
filePathThe absolute path to the graphML file

Definition at line 16 of file GraphManager.cpp.

◆ source()

size_t GraphManager::source ( const EdgeDescriptor & edge) const

Retrieves the source vertex index for the given Edge.

Parameters
edgethe EdgeDescriptor
Returns
the source vertex index for the given Edge

Definition at line 56 of file GraphManager.cpp.

◆ target()

size_t GraphManager::target ( const EdgeDescriptor & edge) const

Retrieves the target vertex index for the given Edge.

Parameters
edgethe EdgeDescriptor
Returns
the target vertex index for the given Edge

Definition at line 61 of file GraphManager.cpp.

◆ vertices()

pair< GraphManager::VertexIterator, GraphManager::VertexIterator > GraphManager::vertices ( )

Exposes the BGL Vertex Iterators of the stored Graph.

Returns
a pair of VertexIterators where first points to the beginning and second points to the end of the vertices vector

Definition at line 46 of file GraphManager.cpp.


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