public static <NodeType extends IGraphNode<NodeType>>
      Pair<Tree<NodeType>, HashMap<NodeType, ITreeNode<NodeType>>> calculate(
          final IDirectedGraph<NodeType, ?> graph, final NodeType rootNode)
          throws MalformedGraphException {
    Preconditions.checkNotNull(graph, "Error: Graph argument can not be null");
    Preconditions.checkNotNull(rootNode, "Error: Root node argument can not be null");

    if (graph.nodeCount() == 0) {
      return new Pair<Tree<NodeType>, HashMap<NodeType, ITreeNode<NodeType>>>(null, null);
    }

    return calculate(graph.getNodes(), rootNode);
  }
Generates the dominator tree of a directed graph.

@param <NodeType> Type of the nodes in the graph.
@param graph The input graph.
@param rootNode The node that is considered the root node of the graph.
@return The dominator tree created from the graph.
java/zylib/src/main/java/com/google/security/zynamics/zylib/types/graphs/algorithms/LengauerTarjan.java