### Question:
MapDTGraph implements DTGraph<L, T>, HasPersistentNodes, HasPersistentLinks { public String toString() { StringBuffer sb = new StringBuffer(); sb.append("digraph {"); Set<MapDTNode> nodes = new HashSet<MapDTNode>(nodeList); boolean first = true; for(MapDTLink link : links()) { if(first) first = false; else sb.append("; "); sb.append(link); nodes.remove(link.first()); nodes.remove(link.second()); } for(MapDTNode node : nodes) sb.append("; " + node); sb.append("}"); return sb.toString(); } MapDTGraph(); static MapDTGraph<L, T> copy(DTGraph<L, T> graph); static MapDTGraph<L, Object> copy(DGraph<L> graph); @Override DTNode<L, T> node(L label); int size(); @Override Set<? extends DTNode<L, T>> nodes(L label); @Override DTNode<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 DTNode<L, T>> nodes(); @Override Iterable<MapDTLink> links(); @Override Set<T> tags(); @Override DTNode<L, T> get(int i); @Override int hashCode(); @Override boolean equals(Object other); @Override Class<? extends DTGraph<L, T>> level();  }### Answer:
@Test public void testToString() { DTGraph<String, Double> graph = new MapDTGraph<String, Double>(); DTNode<String, Double> a = graph.add("a"), b = graph.add("b"), c = graph.add("c"); a.connect(b, 0.5); System.out.println(graph); }