615

The problem is to finding a tree from a given graph.The main challenge is that the value of the node is not provided.

So adjacency matrix can not be used to solve the problem.

To define a tree for a directed graph : total edges = total vertices -1;root can not be more than one, each node must have one in coming edge (except root has 0),using dfs/bfs all the node can be traversed from root(each node has a unique path from tree.)

 

Leave a Reply

Your email address will not be published. Required fields are marked *