TheAlgorithms/C++ 1.0.0
All the 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 adjList) | |
Graph (unsigned int vertices, AdjList &&adjList) | |
Graph (unsigned int vertices, std::vector< Edge > const &edges) | |
std::remove_reference< AdjList >::type const & | getAdjList () const |
unsigned int | 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 | ford_fulkerson () |
void | print_flow_info () |
Public Attributes | |
int | vertexNum |
int | edgeNum |
std::vector< Edge > | edges |
int ** | edges |
Private Member Functions | |
bool | bfs (int source, int sink) |
Private Attributes | |
unsigned int | m_vertices = 0 |
AdjList | m_adjList |
std::vector< std::vector< int > > | residual_capacity |
std::vector< std::vector< int > > | capacity |
int | total_nodes = 0 |
int | total_edges = 0 |
int | source = 0 |
int | sink = 0 |
std::vector< int > | parent |
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).
Definition at line 14 of file bellman_ford.cpp.
|
inline |
Definition at line 20 of file bellman_ford.cpp.
|
inline |
Definition at line 17 of file floyd_warshall.cpp.
|
inline |
Definition at line 27 of file floyd_warshall.cpp.
|
inline |
Definition at line 57 of file cycle_check_directed_graph.cpp.
|
inline |
Create a graph from vertices and adjacency list.
vertices | specify the number of vertices the graph would contain. |
adjList | is the adjacency list representation of graph. |
Definition at line 69 of file cycle_check_directed_graph.cpp.
|
inline |
Create a graph from vertices and adjacency list.
vertices | specify the number of vertices the graph would contain. |
adjList | is the adjacency list representation of graph. |
Definition at line 77 of file cycle_check_directed_graph.cpp.
|
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. |
Definition at line 89 of file cycle_check_directed_graph.cpp.
|
inline |
Add an edge in the graph.
edge | that needs to be added. |
Definition at line 125 of file cycle_check_directed_graph.cpp.
|
inline |
Definition at line 27 of file bellman_ford.cpp.
|
inline |
Definition at line 35 of file floyd_warshall.cpp.
|
inline |
Add an Edge in the graph
source | is source vertex of the edge. |
destination | is the destination vertex of the edge. |
Definition at line 137 of file cycle_check_directed_graph.cpp.
|
inline |
Add vertices in the graph.
num | is the number of vertices to be added. It adds 1 vertex by default. |
Definition at line 119 of file cycle_check_directed_graph.cpp.
|
inlineprivate |
Definition at line 26 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
|
inline |
Definition at line 62 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
|
inline |
Return a const reference of the adjacency list.
Definition at line 104 of file cycle_check_directed_graph.cpp.
|
inline |
Definition at line 111 of file cycle_check_directed_graph.cpp.
|
inline |
Definition at line 81 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
|
inline |
Definition at line 50 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
|
private |
Definition at line 19 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
|
private |
Definition at line 23 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
int Graph::edgeNum |
Definition at line 16 of file bellman_ford.cpp.
std::vector<Edge> Graph::edges |
Definition at line 17 of file bellman_ford.cpp.
int** Graph::edges |
Definition at line 14 of file floyd_warshall.cpp.
|
private |
Definition at line 147 of file cycle_check_directed_graph.cpp.
|
private |
Definition at line 146 of file cycle_check_directed_graph.cpp.
|
private |
Definition at line 25 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
|
private |
Definition at line 22 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
|
private |
Definition at line 19 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
|
private |
Definition at line 21 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
|
private |
Definition at line 21 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
|
private |
Definition at line 21 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
|
private |
Definition at line 20 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
int Graph::vertexNum |
Definition at line 16 of file bellman_ford.cpp.
|
private |
Definition at line 24 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.