@Test public void testConnected() { Global.randomSeed(); UGraph<String> graph = new DiskUGraph(r()); UNode<String> a = graph.add(null), b = graph.add(null), c = graph.add(null); a.connect(b); a.connect(c); assertTrue(a.connected(b)); assertFalse(a.connected(a)); assertTrue(b.connected(a)); assertTrue(a.connected(c)); assertTrue(c.connected(a)); assertFalse(b.connected(c)); assertFalse(c.connected(b)); }
@Override public boolean connected(String from, String to) { for(UNode<String> a : nodes(from)) for(UNode<String> b : nodes(to)) if(a.connected(b)) return true; return false; }
DiskUGraph implements UGraph<String>, FastWalkable<String, UNode<String>> { @Override public boolean connected(String from, String to) { for(UNode<String> a : nodes(from)) for(UNode<String> b : nodes(to)) if(a.connected(b)) return true; return false; } }
DiskUGraph implements UGraph<String>, FastWalkable<String, UNode<String>> { @Override public boolean connected(String from, String to) { for(UNode<String> a : nodes(from)) for(UNode<String> b : nodes(to)) if(a.connected(b)) return true; return false; } DiskUGraph(File dbFile);  DiskUGraph(File dbFile, boolean nullLabels); }
DiskUGraph implements UGraph<String>, FastWalkable<String, UNode<String>> { @Override public boolean connected(String from, String to) { for(UNode<String> a : nodes(from)) for(UNode<String> b : nodes(to)) if(a.connected(b)) return true; return false; } DiskUGraph(File dbFile);  DiskUGraph(File dbFile, boolean nullLabels); @Override int size(); @Override long numLinks(); @Override UNode<String> node(String label); @Override Collection<? extends UNode<String>> nodes(String label); @Override List<? extends UNode<String>> nodes(); @Override Iterable<? extends ULink<String>> links(); @Override UNode<String> add(String label); @Override Set<String> labels(); @Override boolean connected(String from, String to); @Override long state(); String toString(); void sort(); static DiskUGraph copy(Graph<String> graph, File db); @Override int hashCode(); boolean equals(Object other); @Override UNode<String> get(int i); @SuppressWarnings("unchecked") @Override Class<? extends UGraph<String>> level(); @Override List<UNode<String>> neighborsFast(Node<String> node); static DiskUGraph fromDB(File dbFile); static DiskUGraph fromFile(File file, File dir); static DiskUGraph fromFile(File file, File tmpDir, File dbFile); void close(); }
DiskUGraph implements UGraph<String>, FastWalkable<String, UNode<String>> { @Override public boolean connected(String from, String to) { for(UNode<String> a : nodes(from)) for(UNode<String> b : nodes(to)) if(a.connected(b)) return true; return false; } DiskUGraph(File dbFile);  DiskUGraph(File dbFile, boolean nullLabels); @Override int size(); @Override long numLinks(); @Override UNode<String> node(String label); @Override Collection<? extends UNode<String>> nodes(String label); @Override List<? extends UNode<String>> nodes(); @Override Iterable<? extends ULink<String>> links(); @Override UNode<String> add(String label); @Override Set<String> labels(); @Override boolean connected(String from, String to); @Override long state(); String toString(); void sort(); static DiskUGraph copy(Graph<String> graph, File db); @Override int hashCode(); boolean equals(Object other); @Override UNode<String> get(int i); @SuppressWarnings("unchecked") @Override Class<? extends UGraph<String>> level(); @Override List<UNode<String>> neighborsFast(Node<String> node); static DiskUGraph fromDB(File dbFile); static DiskUGraph fromFile(File file, File dir); static DiskUGraph fromFile(File file, File tmpDir, File dbFile); void close(); static final int NEIGHBOR_CAPACITY; }