graph algo
graph algo
(MST)
Step 1: Initialization
o If adding the edge (u, v) does not form a cycle in the MST
(check if u and v are in the same set):
Step 4: Stop
Step 1: Initialization
Step 3: Stop
The algorithm stops when all vertices are included in the MST, and
the MST contains n - 1 edges, where n is the total number of
vertices.
Dijkstra's Algorithm
Step 1: Initialization
Step 3: Stop
Step 1: Initialization
Step 3: Stop
Bellman-Ford Algorithm
Step 1: Start
Step 2: Initialization
The algorithm stops, and either the shortest paths from the start
vertex to all other vertices are found, or a negative weight cycle is
detected.