|
Algorithms_in_C++
1.0.0
Set of algorithms implemented in C++.
|
Public Member Functions | |
| Graph (int V, int E) | |
| void | addEdge (int src, int dst, int weight) |
| Graph (int V) | |
| void | addEdge (int src, int dst, int weight) |
| Graph (Graph &&)=default | |
| Graph & | operator= (Graph &&)=default |
| Graph (Graph const &)=default | |
| Graph & | operator= (Graph const &)=default |
| Graph (unsigned int vertices, AdjList const &adjList) | |
| Graph (unsigned int vertices, AdjList &&adjList) | |
| Graph (unsigned int vertices, std::vector< Edge > const &edges) | |
| std::remove_reference_t< AdjList > const & | getAdjList () const |
| std::remove_reference_t< unsigned int > const & | getVertices () const |
| void | addVertices (unsigned int num=1) |
| void | addEdge (Edge const &edge) |
| void | addEdge (unsigned int source, unsigned int destination) |
| void | set_graph (void) |
| void | ford_fulkerson (void) |
| void | print_flow_info (void) |
| Graph (const int V) | |
| void | addEdge (int src, int dst, int weight) |
Public Attributes | |
| int | vertexNum |
| int | edgeNum |
| Edge * | edges |
| int ** | edges |
Private Member Functions | |
| bool | bfs (int source, int sink) |
Private Attributes | |
| unsigned int | m_vertices |
| AdjList | m_adjList |
| int | residual_capacity [MAXN][MAXN] |
| int | capacity [MAXN][MAXN] |
| int | total_nodes |
| int | total_edges |
| int | source |
| int | sink |
| int | parent [MAXN] |
| std::vector< std::tuple< int, int, int > > | edge_participated |
| std::bitset< MAXN > | visited |
| int | max_flow = 0 |
Implementation of graph class.
The graph will be represented using Adjacency List representation. This class contains 2 data members "m_vertices" & "m_adjList" used to represent the number of vertices and adjacency list of the graph respectively. The vertices are labelled 0 - (m_vertices - 1).
|
inline |
|
inline |
|
inline |
Create a graph from vertices and a set of edges.
Adjacency list of the graph would be created from the set of edges. If the source or destination of any edge has a value greater or equal to number of vertices, then it would throw a range_error.
| vertices | specify the number of vertices the graph would contain. |
| edges | is a vector of edges. |
|
inline |
Add an edge in the graph.
| edge | that needs to be added. |
|
inline |
Add an Edge in the graph
| source | is source vertex of the edge. |
| destination | is the destination vertex of the edge. |
|
inline |
|
inline |
|
inline |