Skip to content

Commit c1d3d23

Browse files
committed
Added descriptions to various graph algo codes .
1 parent 4c9aaf9 commit c1d3d23

File tree

6 files changed

+18
-0
lines changed

6 files changed

+18
-0
lines changed

Graph_Algorithms/BellmanFord.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// This algorithm is used to find the shortest path from a single source vertex to all other vertices, even in the presence of negative weight edges. It can detect negative weight cycles.
2+
3+
14
#include <iostream>
25
#include <vector>
36
#include <climits>

Graph_Algorithms/DSU.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//DSU is a data structure used to manage a partition of a set into disjoint subsets. It supports operations like union (merging two subsets) and find (finding the representative element of a subset).
2+
13
#include <iostream>
24
#include <vector>
35

Graph_Algorithms/Dijkstra.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2+
// Dijkstra's algorithm is a widely used algorithm for finding the shortest path from a single source vertex to all other vertices in a weighted graph. It's particularly useful for graphs with non-negative edge weights.
3+
4+
15
#include <iostream>
26
#include <vector>
37
#include <queue>

Graph_Algorithms/Floyyd_Warshall.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Floyd-Warshall is an all-pairs shortest path algorithm. It computes the shortest paths between all pairs of vertices in a weighted graph, including negative weight edges.
2+
3+
14
#include <iostream>
25
#include <vector>
36
#include <climits>

Graph_Algorithms/Kruskal.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
//Kruskal's algorithm is used to find the Minimum Spanning Tree (MST) of a connected, undirected graph. It does this by selecting edges with the smallest weight while avoiding cycles.
3+
14
#include <iostream>
25
#include <vector>
36
#include <algorithm>

Graph_Algorithms/Prims_Algo.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
//Prim's algorithm is another approach to find the Minimum Spanning Tree (MST). It starts with an arbitrary vertex and grows the MST one vertex at a time by selecting the edge with the minimum weight.
3+
14
#include <iostream>
25
#include <vector>
36
#include <queue>

0 commit comments

Comments
 (0)