Skip to content

Commit

Permalink
add Dijkstra alg function comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mmvergara committed Jun 26, 2023
1 parent 5ff7458 commit 910e593
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions greedy_algorithms/dijkstra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,15 @@ void print(int dist[], int V) {
}


// Finds the shortest path from the given source to all other vertices using Dijkstra's Algorithm.
// Note: It doesn't work with negative weights.
/**
* @brief Finds the shortest path from the given source to all other vertices using Dijkstra's Algorithm.
*
* Note: This implementation doesn't work with negative weights.
*
* @param graph The graph object representing the graph.
* @param src The source vertex.
* @return void
*/
void Dijkstra(Graph graph, int src) {
int V = graph.vertexNum;
int mdist[V]; // Stores updated distances to vertex
Expand Down

0 comments on commit 910e593

Please sign in to comment.