Example #1
0
 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;
 }
Example #2
0
 public IndexMap<Node> getNodeMap() {
   if (nodeMap == null) {
     nodeMap = new IndexMap<Node>();
     for (Node node : getNodes()) nodeMap.set(node);
   }
   return nodeMap;
 }