### Question:
LightDGraph implements DGraph<L>, FastWalkable<L, DNode<L>> { @Override public DNode<L> add(L label) { labels.add(label); in.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); out.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); sorted = false; return new LightDNode(in.size() - 1); } LightDGraph();  LightDGraph(int capacity); @Override int size(); @Override long numLinks(); @Override DNode<L> node(L label); @Override Collection<? extends DNode<L>> nodes(L label); @Override List<? extends DNode<L>> nodes(); @Override Iterable<? extends DLink<L>> links(); @Override DNode<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 LightDGraph<L> copy(Graph<L> graph); @Override int hashCode(); boolean equals(Object other); @Override DNode<L> get(int i); @SuppressWarnings("unchecked") @Override Class<? extends DGraph<L>> level(); @Override List<DNode<L>> neighborsFast(Node<L> node); static final int NEIGHBOR_CAPACITY; }### Answer:
@Test public void testNeighbors() { DGraph<String> graph = new LightDGraph<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); }