### Question:
MapUTGraph implements UTGraph<L, T>, HasPersistentNodes, HasPersistentLinks { @Override public UTNode<L, T> add(L label) { UTNode<L, T> node = new MapUTNode(label); modCount++; return node; } 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();  }### Answer:
@Test public void testNeighbors() { UGraph<String> graph = new LightUGraph<String>(); UNode<String> a = graph.add("a"); UNode<String> b = graph.add("b"); UNode<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); }
@Test public void starTest() { UTGraph<String, Double> graph = new MapUTGraph<String, Double>(); UTNode<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); a.disconnect(b); System.out.println(graph); a.remove(); System.out.println(graph); }