The Finite Resolution Dynamics Software
Public Member Functions | Private Attributes | List of all members
Graph Class Reference

A directed graph class with some algorithms built-in. More...

#include <graph.h>

Public Member Functions

void addVertex (void)
 Adds a vertex. More...
 
void addEdge (int target)
 Adds an edge starting at the last vertex. More...
 
int countVertices (void) const
 Returns the number of vertices. More...
 
int countEdges (void) const
 Returns the number of edges. More...
 
int countEdges (int vertex) const
 Counts the number of edges leaving the given vertex. More...
 
int getEdge (int vertex, int i) const
 Retrieves the given edge that leaves the given vertex. More...
 
bool checkStronglyConnected () const
 Verifies if the graph is strongly connected. More...
 
bool checkAperiodic () const
 Verifies if the graph is aperiodic. More...
 

Private Attributes

chomp::homology::diGraph g
 The underlying graph object. More...
 

Detailed Description

A directed graph class with some algorithms built-in.

This class defines a directed graph which is optimized for the particular application in this project. It supports a very limited number of operations, but these operations are very fast. This class also implements a few algorithms necessary in this project. This particular implementation is a wrapper for the class "diGraph" available in the CHomP software package. Note: The default constructor, destructor and assignment operator are good for this class, so none are defined.

Definition at line 63 of file graph.h.

Member Function Documentation

◆ addEdge()

void Graph::addEdge ( int  target)
inline

Adds an edge starting at the last vertex.

Note: The range of the target vertex number is not verified.

Definition at line 105 of file graph.h.

References g.

◆ addVertex()

void Graph::addVertex ( void  )
inline

Adds a vertex.

Definition at line 99 of file graph.h.

References g.

◆ checkAperiodic()

bool Graph::checkAperiodic ( ) const
inline

Verifies if the graph is aperiodic.

Definition at line 145 of file graph.h.

References g.

◆ checkStronglyConnected()

bool Graph::checkStronglyConnected ( ) const
inline

Verifies if the graph is strongly connected.

This function uses Tarjan's algorithm (as described in the Wikipedia) for the computation of strongly connected components in order to determine whether the given graph is strongly connected.

Tha advantage of this approach over the one described in Cormen's textbook is that the transposed graph need not be computed.

Definition at line 138 of file graph.h.

References countVertices(), and g.

◆ countEdges() [1/2]

int Graph::countEdges ( void  ) const
inline

Returns the number of edges.

Definition at line 116 of file graph.h.

References g.

Referenced by countEdges().

◆ countEdges() [2/2]

int Graph::countEdges ( int  vertex) const
inline

Counts the number of edges leaving the given vertex.

Definition at line 121 of file graph.h.

References countEdges(), and g.

◆ countVertices()

int Graph::countVertices ( void  ) const
inline

Returns the number of vertices.

Definition at line 111 of file graph.h.

References g.

Referenced by checkStronglyConnected().

◆ getEdge()

int Graph::getEdge ( int  vertex,
int  i 
) const
inline

Retrieves the given edge that leaves the given vertex.

Definition at line 126 of file graph.h.

References g.

Member Data Documentation

◆ g

chomp::homology::diGraph Graph::g
private

The underlying graph object.

Definition at line 93 of file graph.h.

Referenced by addEdge(), addVertex(), checkAperiodic(), checkStronglyConnected(), countEdges(), countVertices(), and getEdge().


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