TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Functions for the Dijkstra algorithm implementation. More...
Classes | |
class | Graph |
Wrapper class for storing a graph. More... | |
Functions | |
int | minimum_distance (std::vector< int > mdist, std::vector< bool > vset, int V) |
Utility function that finds the vertex with the minimum distance in mdist . | |
void | print (std::vector< int > dist, int V) |
Utility function to print the distances to vertices. | |
void | dijkstra (Graph graph, int src) |
The main function that finds the shortest path from a given source to all other vertices using Dijkstra's Algorithm. | |
Functions for the Dijkstra algorithm implementation.
void greedy_algorithms::dijkstra::dijkstra | ( | Graph | graph, |
int | src ) |
The main function that finds the shortest path from a given source to all other vertices using Dijkstra's Algorithm.
graph | the graph to be processed |
src | the source of the given vertex |
Definition at line 124 of file dijkstra_greedy.cpp.
int greedy_algorithms::dijkstra::minimum_distance | ( | std::vector< int > | mdist, |
std::vector< bool > | vset, | ||
int | V ) |
Utility function that finds the vertex with the minimum distance in mdist
.
mdist | array of distances to each vertex |
vset | array indicating inclusion in the shortest path tree |
V | the number of vertices in the graph |
Definition at line 82 of file dijkstra_greedy.cpp.
void greedy_algorithms::dijkstra::print | ( | std::vector< int > | dist, |
int | V ) |
Utility function to print the distances to vertices.
This function prints the distances to each vertex in a tabular format. If the distance is equal to INT_MAX, it is displayed as "INF".
dist | An array representing the distances to each vertex. |
V | The number of vertices in the graph. |
Definition at line 104 of file dijkstra_greedy.cpp.