Esempio n. 1
0
 public void printGraph() {
   Set<String> nodes = graph.getAllNodes();
   System.out.println("graph data\n{");
   for (String node : nodes) {
     List<Edge<String>> edges = graph.getEdgesFor(node);
     for (Edge<String> edge : edges) {
       if (edge.getDestination().compareTo(node) < 0)
         System.out.println(
             node + " -- " + edge.getDestination() + "[label=" + edge.getWeight() + "];");
     }
   }
   System.out.println("}");
 }