I have a graph with properties as shown below:
Adjacency matrix:

Graph Presentation:

What algorithm can be used to search the hierarchy tree of the above graph? In my opinion, a hierarchy tree is one in which the nodes are connected and directed only at their immediate child, and any edge from the current to the child of the child or any other should be removed.
In the above graph, the hierarchy tree will look like this:
Hierarchy tree:

source
share