Given a list of all the nodes in a Graph, G, a list of all the existing connections (edges) and a list of the adjacency lists of all the nodes, how can one proceed to find out the list of dominators of a given node?
One way I was thinking of is as follows:
For a given node, N, find out all the paths from the root node to N. The intersection of these paths will give me a set of nodes that dominate N. But the catch here is, how do I really find out the paths? Especially, while coding in JAVA.
Any helpful answers, in specific, would be appreciated.
Thank you!
I implemented Tarjan’s algorithm successfully.
FWIW, it goes like:
To find out a set of nodes that n dominates, just compute all the paths (easy to deal with, once we have the adjacency lists of all the nodes) from the start node to the rest of the nodes avoiding n. Let this reachable set of nodes be R. The nodes that n would dominate are the ones that are not present in R. That is to say, if U be the set of all the nodes of a given graph, n would dominate the nodes belonging to the set U-R.