dfs and prims algorithm code example
Example: dfs algorithm output
X - 1 - 2 - 3
| \
1 1
| \
2 2
| \
3 3
BFS: X 1 1 1 2 2 2 3 3 3
DFS: X 1 2 3 1 2 3 1 2 3
X - 1 - 2 - 3
| \
1 1
| \
2 2
| \
3 3
BFS: X 1 1 1 2 2 2 3 3 3
DFS: X 1 2 3 1 2 3 1 2 3