public String toString() { IndexMap<Node> map = new IndexMap<Node>(numNodes()); String s = ""; for (Node node : getNodes()) s += "Node " + map.set(node) + ": " + node + "\n"; s += "Roots: "; for (Node node : getRoots()) s += map.get(node) + " "; s += "\nEdges:\n"; for (Node node : getNodes()) { int i = map.get(node); for (Node node2 : getSuccs(node)) s += i + " -> " + map.get(node2) + "\n"; } return s; }