@Test public void testConnected() { 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); assertTrue(a.connected(b)); assertTrue(a.connectedTo(b)); assertFalse(a.connected(a)); assertFalse(a.connectedTo(a)); assertTrue(b.connected(a)); assertFalse(b.connectedTo(a)); assertFalse(a.connected(c)); assertFalse(a.connectedTo(c)); assertFalse(c.connected(a)); assertFalse(c.connectedTo(a)); assertFalse(b.connected(c)); assertFalse(b.connectedTo(c)); assertFalse(c.connected(b)); assertFalse(c.connectedTo(b)); }
@Override public boolean connected(L first, L second) { for(MapDTNode f : nodes.get(first)) for(MapDTNode s : nodes.get(second)) if(f.connected(s)) return true; return false; }
MapDTGraph implements DTGraph<L, T>, HasPersistentNodes, HasPersistentLinks { @Override public boolean connected(L first, L second) { for(MapDTNode f : nodes.get(first)) for(MapDTNode s : nodes.get(second)) if(f.connected(s)) return true; return false; } }
MapDTGraph implements DTGraph<L, T>, HasPersistentNodes, HasPersistentLinks { @Override public boolean connected(L first, L second) { for(MapDTNode f : nodes.get(first)) for(MapDTNode s : nodes.get(second)) if(f.connected(s)) return true; return false; } MapDTGraph(); }
MapDTGraph implements DTGraph<L, T>, HasPersistentNodes, HasPersistentLinks { @Override public boolean connected(L first, L second) { for(MapDTNode f : nodes.get(first)) for(MapDTNode s : nodes.get(second)) if(f.connected(s)) return true; return false; } 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(); }
MapDTGraph implements DTGraph<L, T>, HasPersistentNodes, HasPersistentLinks { @Override public boolean connected(L first, L second) { for(MapDTNode f : nodes.get(first)) for(MapDTNode s : nodes.get(second)) if(f.connected(s)) return true; return false; } 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();  }