#include <graph.h>
Public Member Functions | |
| void | addVertex (void) |
| Adds a vertex. | |
| void | addEdge (int target) |
| Adds an edge starting at the last vertex. | |
| int | countVertices (void) const |
| Returns the number of vertices. | |
| int | countEdges (void) const |
| Returns the number of edges. | |
| int | countEdges (int vertex) const |
| Counts the number of edges leaving the given vertex. | |
| int | getEdge (int vertex, int i) const |
| Retrieves the given edge that leaves the given vertex. | |
| bool | checkStronglyConnected () const |
| Verifies if the graph is strongly connected. | |
| bool | checkAperiodic () const |
| Verifies if the graph is aperiodic. | |
Private Attributes | |
| chomp::homology::diGraph | g |
| The underlying graph object. | |
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.
| void Graph::addVertex | ( | void | ) | [inline] |
| void Graph::addEdge | ( | int | target | ) | [inline] |
| int Graph::countVertices | ( | void | ) | const [inline] |
Returns the number of vertices.
Definition at line 111 of file graph.h.
References g.
Referenced by checkStronglyConnected().
| int Graph::countEdges | ( | void | ) | const [inline] |
Returns the number of edges.
Definition at line 116 of file graph.h.
References g.
Referenced by countEdges().
| 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.
| int Graph::getEdge | ( | int | vertex, | |
| int | i | |||
| ) | const [inline] |
| 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.
| bool Graph::checkAperiodic | ( | ) | const [inline] |
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().
1.5.3