A simple weighted directed graph.
More...
|
| | Graph (const unsigned int n) |
| | Construct the graph with a specified number of vertices. More...
|
| |
| | Graph (const unsigned int n, E *verts) |
| | Construct the graph with an existing list of vertices. More...
|
| |
|
| ~Graph () |
| | Destructor.
|
| |
| E * | prev (int vert) |
| | Get an arbitrary previous vertex. More...
|
| |
| E * | next (int vert) |
| | Get an arbitrary next vertex. More...
|
| |
| void | setEdge (const unsigned int v1, const unsigned int v2) |
| | Add an edge to the graph. More...
|
| |
| void | removeEdge (const unsigned int v1, const unsigned int v2) |
| | Remove an edge from the graph. More...
|
| |
| unsigned int | size () const |
| | Get the max number of vertices in the graph. More...
|
| |
|
|
const unsigned int | numVerts |
| | The number of vertices stored in the graph.
|
| |
|
E * | v |
| | The list of vertices.
|
| |
|
bool ** | e |
| | Adjacency matrix representing edges in the graph.
|
| |
|
W ** | w |
| | Weight matrix for each directional edge.
|
| |
template<typename E, typename W>
struct Graph< E, W >
A simple weighted directed graph.
◆ Graph() [1/2]
template<typename E , typename W >
Construct the graph with a specified number of vertices.
- Parameters
-
| n | number of vertices in the graph |
◆ Graph() [2/2]
template<typename E , typename W >
| Graph< E, W >::Graph |
( |
const unsigned int |
n, |
|
|
E * |
verts |
|
) |
| |
|
inline |
Construct the graph with an existing list of vertices.
- Parameters
-
| n | number of vertices in the graph |
| verts | list of vertices |
◆ next()
template<typename E , typename W >
| E* Graph< E, W >::next |
( |
int |
vert | ) |
|
|
inline |
Get an arbitrary next vertex.
- Parameters
-
- Returns
- returns pointer to an arbitrary next vertex or NULL if there is none
◆ prev()
template<typename E , typename W >
| E* Graph< E, W >::prev |
( |
int |
vert | ) |
|
|
inline |
Get an arbitrary previous vertex.
- Parameters
-
- Returns
- returns pointer to an arbitrary previous vertex or NULL if there is none
◆ removeEdge()
template<typename E , typename W >
| void Graph< E, W >::removeEdge |
( |
const unsigned int |
v1, |
|
|
const unsigned int |
v2 |
|
) |
| |
|
inline |
Remove an edge from the graph.
- Parameters
-
| v1 | index of first vertex of edge |
| v2 | index of second vertex of edge |
◆ setEdge()
template<typename E , typename W >
| void Graph< E, W >::setEdge |
( |
const unsigned int |
v1, |
|
|
const unsigned int |
v2 |
|
) |
| |
|
inline |
Add an edge to the graph.
- Parameters
-
| v1 | index of first vertex of edge |
| v2 | index of second vertex of edge |
◆ size()
template<typename E , typename W >
| unsigned int Graph< E, W >::size |
( |
| ) |
const |
|
inline |
Get the max number of vertices in the graph.
- Returns
- the number of vertices
The documentation for this struct was generated from the following file: