|
Algorithms_in_C++
1.0.0
Set of algorithms implemented in C++.
|
Public Member Functions | |
| graph (int v) | |
| void | addedge (int src, int dest) |
| void | printgraph () |
| void | bfs (int s) |
| graph (int n) | |
| Constructor that intiliazes the graph on creation and set the connected components to 0. | |
| void | addEdge (int, int) |
| Function that add edge between two nodes or vertices of graph. More... | |
| int | getConnectedComponents () |
| Function the calculates the connected compoents in the graph by performing the depth first search on graph. More... | |
Private Member Functions | |
| void | depth_first_search () |
| Function that perfoms depth first search algorithm on graph. | |
| void | explore (int, vector< bool > &) |
| Utility function for depth first seach algorithm this function explores the vertex which is passed into. More... | |
Private Attributes | |
| int | v |
| list< int > * | adj |
| vector< vector< int > > | adj |
| adj stores adjacency list representation of graph | |
| int | connected_components |
| keep track of connected components | |
Class for representing graph as a adjacency list.
| void graph::addEdge | ( | int | u, |
| int | v | ||
| ) |
|
private |
Utility function for depth first seach algorithm this function explores the vertex which is passed into.
| u | vertex or node to be explored |
| visited | already visited vertex |
|
inline |
Function the calculates the connected compoents in the graph by performing the depth first search on graph.