|
Graph Class Reference#include <Graph.h>
List of all members.
Detailed Description
An adjacency list representation of an undirected, weighted graph.
Definition at line 26 of file Graph.h.
Constructor & Destructor Documentation
|
Constructor. - Precondition:
- The graph is empty.
- Postcondition:
- The graph is initialized to hold n vertices.
Definition at line 21 of file Graph.cpp.
References adjList, numEdges, and numVertices. |
Member Function Documentation
int Graph::getNumVertices |
( |
|
) |
const |
|
|
Determines the number of vertices in the graph. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- The number of vertices in the graph.
Definition at line 29 of file Graph.cpp.
References numVertices.
Referenced by BFS::startSearch(). |
int Graph::getNumEdges |
( |
|
) |
const |
|
|
Determines the number of edges in the graph. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- The number of edges in the graph.
Definition at line 34 of file Graph.cpp.
References numEdges. |
int Graph::getWeight |
( |
Edge |
e |
) |
const |
|
|
Determines the weight of an edge. - Precondition:
- The edge exists in the graph.
- Postcondition:
- None.
- Returns:
- The weight of the edge parameter.
Definition at line 39 of file Graph.cpp.
References Edge::weight. |
void Graph::add |
( |
Edge |
e |
) |
|
|
void Graph::remove |
( |
Edge |
e |
) |
|
|
map< int, int >::iterator Graph::findEdge |
( |
int |
v, |
|
|
int |
w |
|
) |
|
|
|
Finds the edge connecting v and w. - Precondition:
- The edge exists.
- Postcondition:
- None.
- Returns:
- An iterator to map key w in vector[v].
Definition at line 66 of file Graph.cpp.
References adjList. |
Member Data Documentation
The documentation for this class was generated from the following files:
|