@Test public void internalDisconnect() { GraphHopperStorage storage = createGHStorage(); BaseGraph graph = (BaseGraph) storage.getGraph(Graph.class); EdgeIteratorState iter0 = graph.edge(0, 1, 10, true); EdgeIteratorState iter2 = graph.edge(1, 2, 10, true); EdgeIteratorState iter3 = graph.edge(0, 3, 10, true); EdgeExplorer explorer = graph.createEdgeExplorer(); assertEquals(GHUtility.asSet(3, 1), GHUtility.getNeighbors(explorer.setBaseNode(0))); assertEquals(GHUtility.asSet(2, 0), GHUtility.getNeighbors(explorer.setBaseNode(1))); // remove edge "1-2" but only from 1 not from 2 graph.edgeAccess.internalEdgeDisconnect( iter2.getEdge(), -1, iter2.getBaseNode(), iter2.getAdjNode()); assertEquals(GHUtility.asSet(0), GHUtility.getNeighbors(explorer.setBaseNode(1))); assertEquals(GHUtility.asSet(1), GHUtility.getNeighbors(explorer.setBaseNode(2))); // let 0 unchanged -> no side effects assertEquals(GHUtility.asSet(3, 1), GHUtility.getNeighbors(explorer.setBaseNode(0))); // remove edge "0-1" but only from 0 graph.edgeAccess.internalEdgeDisconnect( iter0.getEdge(), (long) iter3.getEdge() * graph.edgeEntryBytes, iter0.getBaseNode(), iter0.getAdjNode()); assertEquals(GHUtility.asSet(3), GHUtility.getNeighbors(explorer.setBaseNode(0))); assertEquals(GHUtility.asSet(0), GHUtility.getNeighbors(explorer.setBaseNode(3))); assertEquals(GHUtility.asSet(0), GHUtility.getNeighbors(explorer.setBaseNode(1))); storage.close(); }
@Override public final EdgeExplorer createEdgeExplorer() { return baseGraph.createEdgeExplorer(); }
@Override public final EdgeExplorer createEdgeExplorer(EdgeFilter filter) { return baseGraph.createEdgeExplorer(filter); }