@Test public void testToString() { UTGraph<String, Double> graph = new MapUTGraph<String, Double>(); UTNode<String, Double> a = graph.add("a"), b = graph.add("b"), c = graph.add("c"); a.connect(b, 0.5); System.out.println(graph); }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("graph {"); Set<MapUTNode> nodes = new HashSet<MapUTNode>(nodeList); boolean first = true; for(MapUTLink link : links()) { if(first) first = false; else sb.append("; "); sb.append(link); nodes.remove(link.first()); nodes.remove(link.second()); } for(MapUTNode node : nodes) { if(first) first = false; else sb.append("; "); sb.append(node); } sb.append("}"); return sb.toString(); }
MapUTGraph implements UTGraph<L, T>, HasPersistentNodes, HasPersistentLinks { public String toString() { StringBuffer sb = new StringBuffer(); sb.append("graph {"); Set<MapUTNode> nodes = new HashSet<MapUTNode>(nodeList); boolean first = true; for(MapUTLink link : links()) { if(first) first = false; else sb.append("; "); sb.append(link); nodes.remove(link.first()); nodes.remove(link.second()); } for(MapUTNode node : nodes) { if(first) first = false; else sb.append("; "); sb.append(node); } sb.append("}"); return sb.toString(); } }
MapUTGraph implements UTGraph<L, T>, HasPersistentNodes, HasPersistentLinks { public String toString() { StringBuffer sb = new StringBuffer(); sb.append("graph {"); Set<MapUTNode> nodes = new HashSet<MapUTNode>(nodeList); boolean first = true; for(MapUTLink link : links()) { if(first) first = false; else sb.append("; "); sb.append(link); nodes.remove(link.first()); nodes.remove(link.second()); } for(MapUTNode node : nodes) { if(first) first = false; else sb.append("; "); sb.append(node); } sb.append("}"); return sb.toString(); } MapUTGraph(); }
MapUTGraph implements UTGraph<L, T>, HasPersistentNodes, HasPersistentLinks { public String toString() { StringBuffer sb = new StringBuffer(); sb.append("graph {"); Set<MapUTNode> nodes = new HashSet<MapUTNode>(nodeList); boolean first = true; for(MapUTLink link : links()) { if(first) first = false; else sb.append("; "); sb.append(link); nodes.remove(link.first()); nodes.remove(link.second()); } for(MapUTNode node : nodes) { if(first) first = false; else sb.append("; "); sb.append(node); } sb.append("}"); return sb.toString(); } MapUTGraph(); static MapUTGraph<L, T> copy(UTGraph<L, T> graph); static MapUTGraph<L,T> copy(UGraph<L> graph); @Override UTNode<L, T> node(L label); int size(); @Override Set<? extends UTNode<L, T>> nodes(L label); @Override UTNode<L, T> add(L label); boolean uniqueLabels(); String toString(); @Override boolean connected(L first, L second); @Override Set<L> labels(); @Override long numLinks(); @Override long state(); @Override List<? extends UTNode<L, T>> nodes(); @Override Iterable<MapUTLink> links(); @Override Set<T> tags(); @Override int hashCode(); @Override boolean equals(Object other); @Override UTNode<L, T> get(int i); @Override Class<? extends UTGraph<L, T>> level(); }
MapUTGraph implements UTGraph<L, T>, HasPersistentNodes, HasPersistentLinks { public String toString() { StringBuffer sb = new StringBuffer(); sb.append("graph {"); Set<MapUTNode> nodes = new HashSet<MapUTNode>(nodeList); boolean first = true; for(MapUTLink link : links()) { if(first) first = false; else sb.append("; "); sb.append(link); nodes.remove(link.first()); nodes.remove(link.second()); } for(MapUTNode node : nodes) { if(first) first = false; else sb.append("; "); sb.append(node); } sb.append("}"); return sb.toString(); } MapUTGraph(); static MapUTGraph<L, T> copy(UTGraph<L, T> graph); static MapUTGraph<L,T> copy(UGraph<L> graph); @Override UTNode<L, T> node(L label); int size(); @Override Set<? extends UTNode<L, T>> nodes(L label); @Override UTNode<L, T> add(L label); boolean uniqueLabels(); String toString(); @Override boolean connected(L first, L second); @Override Set<L> labels(); @Override long numLinks(); @Override long state(); @Override List<? extends UTNode<L, T>> nodes(); @Override Iterable<MapUTLink> links(); @Override Set<T> tags(); @Override int hashCode(); @Override boolean equals(Object other); @Override UTNode<L, T> get(int i); @Override Class<? extends UTGraph<L, T>> level();  }