Check if a given graph is tree or not - GeeksQuiz
Check if a given graph is tree or not
Write a function that returns true if a given undirected graph is tree and false otherwise. For example, the following graph is a tree.
But the following graph is not a tree.
An undirected graph is tree if it has following properties.
1) There is no cycle.
2) The graph is connected.
For an undirected graph we can either use BFS or DFS to detect above two properties.
Read full article from Check if a given graph is tree or not - GeeksQuiz
No comments:
Post a Comment