/** * @see LandmarkStorage#setMinimumNodes(int) */ public void setMinimumNodes(int nodes) { if (nodes < 2) throw new IllegalArgumentException("minimum node count must be at least 2"); lms.setMinimumNodes(nodes); }
@Test public void testWithSubnetworks2() { // should not happen with subnetwork preparation // 0 - 1 - 2 = 3 - 4 ghStorage.edge(0, 1, 10, true); ghStorage.edge(1, 2, 10, true); ghStorage.edge(2, 3, 10, false); ghStorage.edge(3, 2, 10, false); ghStorage.edge(3, 4, 10, true); LandmarkStorage storage = new LandmarkStorage(ghStorage, new RAMDirectory(), new FastestWeighting(encoder), 2); storage.setMinimumNodes(3); storage.createLandmarks(); assertEquals(2, storage.getSubnetworksWithLandmarks()); assertEquals("[4, 0]", Arrays.toString(storage.getLandmarks(1))); }
@Test public void testWithSubnetworks() { ghStorage.edge(0, 1, 10, true); ghStorage.edge(1, 2, 10, true); ghStorage.edge(2, 4).setFlags(encoder.setAccess(0, false, false)); ghStorage.edge(4, 5, 10, true); ghStorage.edge(5, 6, 10, false); LandmarkStorage storage = new LandmarkStorage(ghStorage, new RAMDirectory(), new FastestWeighting(encoder), 2); storage.setMinimumNodes(2); storage.createLandmarks(); assertEquals(3, storage.getSubnetworksWithLandmarks()); assertEquals("[2, 0]", Arrays.toString(storage.getLandmarks(1))); assertEquals("[6, 4]", Arrays.toString(storage.getLandmarks(2))); }
@Test public void testWeightingConsistence() { // create an indifferent problem: shortest weighting can pass the speed==0 edge but fastest cannot (?) ghStorage.edge(0, 1, 10, true); ghStorage.edge(1, 2).setDistance(10).setFlags(encoder.setProperties(0.9, true, true)); ghStorage.edge(2, 3, 10, true); LandmarkStorage storage = new LandmarkStorage(ghStorage, new RAMDirectory(), new FastestWeighting(encoder), 2); storage.setMinimumNodes(2); storage.createLandmarks(); assertEquals(2, storage.getSubnetworksWithLandmarks()); assertEquals("[1, 0]", Arrays.toString(storage.getLandmarks(1))); }
@Test public void testWithOnewaySubnetworks() { // should not happen with subnetwork preparation // create an indifferent problem: node 2 and 3 are part of two 'disconnected' subnetworks ghStorage.edge(0, 1, 10, true); ghStorage.edge(1, 2, 10, false); ghStorage.edge(2, 3, 10, false); ghStorage.edge(4, 5, 10, true); ghStorage.edge(5, 2, 10, false); LandmarkStorage storage = new LandmarkStorage(ghStorage, new RAMDirectory(), new FastestWeighting(encoder), 2); storage.setMinimumNodes(2); storage.createLandmarks(); assertEquals(2, storage.getSubnetworksWithLandmarks()); assertEquals("[4, 0]", Arrays.toString(storage.getLandmarks(1))); }
storage.setMinimumNodes(2); storage.createLandmarks(); assertEquals(3, storage.getSubnetworksWithLandmarks());
Weighting weighting = new FastestWeighting(encoder); LandmarkStorage store = new LandmarkStorage(graph, dir, weighting, lm); store.setMinimumNodes(2); store.createLandmarks();
/** * @see LandmarkStorage#setMinimumNodes(int) */ public void setMinimumNodes(int nodes) { if (nodes < 2) throw new IllegalArgumentException("minimum node count must be at least 2"); lms.setMinimumNodes(nodes); }
/** * @see LandmarkStorage#setMinimumNodes(int) */ public void setMinimumNodes(int nodes) { if (nodes < 2) throw new IllegalArgumentException("minimum node count must be at least 2"); lms.setMinimumNodes(nodes); }