@Test public void testToString() { UGraph<String> graph = new LightUGraph<String>(); UNode<String> a = graph.add("a"), b = graph.add("b"); graph.add("c"); a.connect(b); System.out.println(graph); }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("graph {"); Set<UNode<L>> nodes = new HashSet<UNode<L>>(nodes()); int i = 0; for(ULink<L> link : links()) { if(i++ != 0) sb.append(";"); sb.append(link); nodes.remove(link.first()); nodes.remove(link.second()); } for(UNode<L> node : nodes) { if(i++ != 0) sb.append(";"); sb.append(node); } sb.append("}"); return sb.toString(); }
LightUGraph implements UGraph<L>, FastWalkable<L, UNode<L>> { public String toString() { StringBuffer sb = new StringBuffer(); sb.append("graph {"); Set<UNode<L>> nodes = new HashSet<UNode<L>>(nodes()); int i = 0; for(ULink<L> link : links()) { if(i++ != 0) sb.append(";"); sb.append(link); nodes.remove(link.first()); nodes.remove(link.second()); } for(UNode<L> node : nodes) { if(i++ != 0) sb.append(";"); sb.append(node); } sb.append("}"); return sb.toString(); } }
LightUGraph implements UGraph<L>, FastWalkable<L, UNode<L>> { public String toString() { StringBuffer sb = new StringBuffer(); sb.append("graph {"); Set<UNode<L>> nodes = new HashSet<UNode<L>>(nodes()); int i = 0; for(ULink<L> link : links()) { if(i++ != 0) sb.append(";"); sb.append(link); nodes.remove(link.first()); nodes.remove(link.second()); } for(UNode<L> node : nodes) { if(i++ != 0) sb.append(";"); sb.append(node); } sb.append("}"); return sb.toString(); } LightUGraph();  LightUGraph(int capacity); }
LightUGraph implements UGraph<L>, FastWalkable<L, UNode<L>> { public String toString() { StringBuffer sb = new StringBuffer(); sb.append("graph {"); Set<UNode<L>> nodes = new HashSet<UNode<L>>(nodes()); int i = 0; for(ULink<L> link : links()) { if(i++ != 0) sb.append(";"); sb.append(link); nodes.remove(link.first()); nodes.remove(link.second()); } for(UNode<L> node : nodes) { if(i++ != 0) sb.append(";"); sb.append(node); } sb.append("}"); return sb.toString(); } LightUGraph();  LightUGraph(int capacity); @Override int size(); @Override long numLinks(); @Override UNode<L> node(L label); @Override Collection<? extends UNode<L>> nodes(L label); @Override List<? extends UNode<L>> nodes(); @Override Iterable<? extends ULink<L>> links(); @Override UNode<L> add(L label); @Override Set<L> labels(); @Override boolean connected(L from, L to); @Override long state(); String toString(); void compact(int margin); void sort(); static LightUGraph<L> copy(Graph<L> graph); @Override int hashCode(); boolean equals(Object other); @Override UNode<L> get(int i); @SuppressWarnings("unchecked") @Override Class<? extends UGraph<L>> level(); @Override List<UNode<L>> neighborsFast(Node<L> node); }
LightUGraph implements UGraph<L>, FastWalkable<L, UNode<L>> { public String toString() { StringBuffer sb = new StringBuffer(); sb.append("graph {"); Set<UNode<L>> nodes = new HashSet<UNode<L>>(nodes()); int i = 0; for(ULink<L> link : links()) { if(i++ != 0) sb.append(";"); sb.append(link); nodes.remove(link.first()); nodes.remove(link.second()); } for(UNode<L> node : nodes) { if(i++ != 0) sb.append(";"); sb.append(node); } sb.append("}"); return sb.toString(); } LightUGraph();  LightUGraph(int capacity); @Override int size(); @Override long numLinks(); @Override UNode<L> node(L label); @Override Collection<? extends UNode<L>> nodes(L label); @Override List<? extends UNode<L>> nodes(); @Override Iterable<? extends ULink<L>> links(); @Override UNode<L> add(L label); @Override Set<L> labels(); @Override boolean connected(L from, L to); @Override long state(); String toString(); void compact(int margin); void sort(); static LightUGraph<L> copy(Graph<L> graph); @Override int hashCode(); boolean equals(Object other); @Override UNode<L> get(int i); @SuppressWarnings("unchecked") @Override Class<? extends UGraph<L>> level(); @Override List<UNode<L>> neighborsFast(Node<L> node); static final int NEIGHBOR_CAPACITY; }