### Question:
MapDTGraph implements DTGraph<L, T>, HasPersistentNodes, HasPersistentLinks { @Override public DTNode<L, T> add(L label) { DTNode<L, T> node = new MapDTNode(label); modCount++; return node; } 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 starTest() { DTGraph<String, Double> graph = new MapDTGraph<String, Double>(); DTNode<String, Double> a = graph.add("a"), b = graph.add("b"), c = graph.add("c"), d = graph.add("d"), e = graph.add("e"); b.connect(a, 0.5); c.connect(a, 0.5); d.connect(a, 0.5); e.connect(a, 0.5); System.out.println(graph); e.disconnect(a); System.out.println(graph); a.remove(); System.out.println(graph); }
@Test public void testNeighbors() { DGraph<String> graph = new MapDTGraph<String, String>(); DNode<String> a = graph.add("a"); DNode<String> b = graph.add("b"); DNode<String> c = graph.add("c"); a.connect(a); b.connect(c); c.connect(a); a.connect(c); a.connect(c); Set<Node<String>> aNbsExpected = new HashSet<Node<String>>(Arrays.asList(a, c)); Set<Node<String>> bNbsExpected = new HashSet<Node<String>>(Arrays.asList(c)); Set<Node<String>> cNbsExpected = new HashSet<Node<String>>(Arrays.asList(b, a)); Set<Node<String>> aNbsActual = new HashSet<Node<String>>(a.neighbors()); Set<Node<String>> bNbsActual = new HashSet<Node<String>>(b.neighbors()); Set<Node<String>> cNbsActual = new HashSet<Node<String>>(c.neighbors()); assertEquals(aNbsExpected, aNbsActual); assertEquals(bNbsExpected, bNbsActual); assertEquals(cNbsExpected, cNbsActual); }