Question

Is DFS and BFS an algorithm to enumerate a connected Graph ? I am doubt if these algorithms is used to make an enumeration for a Graph ?

please explain to me if possible ?

Was it helpful?

Solution

If i understand you correctly, you are asking if DFS and BFS are algorithm to check if Graph is connected.

If that was your question, then Yes.
BFS, DFS as you can read at wiki, are excellent O(n) solutions for checking if Graph is connected. This can be done, but increment every new vertex you encounter and then checking if it equals for the given graph vertex list count.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top