Professional Documents
Culture Documents
Algo DFS BFS Min Cost Shortest Path
Algo DFS BFS Min Cost Shortest Path
I. Breadth-First Search:-
array 'visited' to track status of vertices.
2-D array 'graph' for graph adjacency matrix.
queue 'queue' to store vertices.
1. Set distance[source]=0.
2. Set min distance of all other vertices from source.
3. while no_Vetices-1 repeat step 4.
4. Set min distance between source and nodes
by keeping a vertex as intermediate node.
5. Print all min_distance between source and vertices.
6. Exit.