### Question:
LightDGraph implements DGraph<L>, FastWalkable<L, DNode<L>> { @Override public boolean connected(L from, L to) { for(DNode<L> a : nodes(from)) for(DNode<L> b : nodes(to)) if(a.connected(b)) return true; return false; } 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 testConnected() { DGraph<String> graph = new LightDGraph<String>(); DNode<String> a = graph.add(null), b = graph.add(null), c = graph.add(null); a.connect(b); a.connect(c); assertTrue(a.connected(b)); assertTrue(a.connectedTo(b)); assertFalse(a.connected(a)); assertFalse(a.connectedTo(a)); assertTrue(b.connected(a)); assertFalse(b.connectedTo(a)); assertTrue(a.connected(c)); assertTrue(a.connectedTo(c)); assertTrue(c.connected(a)); assertFalse(c.connectedTo(a)); assertFalse(b.connected(c)); assertFalse(b.connectedTo(c)); assertFalse(c.connected(b)); assertFalse(c.connectedTo(b)); }