DirectGraph (RootStatement root) { this.root = root; graph = new DirectGraph(); flattenStatement(); // dummy exit node Statement dummyexit = root.getDummyExit(); DirectNode node = new DirectNode(DirectNodeType.DIRECT, dummyexit, Integer.toString(dummyexit.id)); node.exprents = new ArrayList<>(); graph.nodes.addWithKey(node, node.id); mapDestinationNodes.put(dummyexit.id, new String[]{node.id, null}); setEdges(); graph.first = graph.nodes.getWithKey(mapDestinationNodes.get(root.id)[0]); graph.sortReversePostOrder(); return graph; }