use of com.graphhopper.coll.GHBitSet in project graphhopper by graphhopper.
the class Measurement method printGraphDetails.
private void printGraphDetails(GraphHopperStorage g, String vehicleStr) {
// graph size (edge, node and storage size)
put("graph.nodes", g.getNodes());
put("graph.edges", g.getAllEdges().length());
put("graph.size_in_MB", g.getCapacity() / MB);
put("graph.encoder", vehicleStr);
final GHBitSet validEdges = getValidEdges(g);
put("graph.valid_edges", validEdges.getCardinality());
}
use of com.graphhopper.coll.GHBitSet in project graphhopper by graphhopper.
the class Measurement method measureGraphTraversal.
private void measureGraphTraversal(final Graph graph, final FlagEncoder encoder, int count) {
final Random rand = new Random(seed);
EdgeFilter outFilter = AccessFilter.outEdges(encoder.getAccessEnc());
final EdgeExplorer outExplorer = graph.createEdgeExplorer(outFilter);
MiniPerfTest miniPerf = new MiniPerfTest().setIterations(count).start((warmup, run) -> {
int nodeId = rand.nextInt(maxNode);
return GHUtility.count(outExplorer.setBaseNode(nodeId));
});
print("unit_tests.out_edge_state_next", miniPerf);
final EdgeExplorer allExplorer = graph.createEdgeExplorer();
miniPerf = new MiniPerfTest().setIterations(count).start((warmup, run) -> {
int nodeId = rand.nextInt(maxNode);
return GHUtility.count(allExplorer.setBaseNode(nodeId));
});
print("unit_tests.all_edge_state_next", miniPerf);
final int maxEdgesId = graph.getAllEdges().length();
GHBitSet allowedEdges = getValidEdges(graph);
miniPerf = new MiniPerfTest().setIterations(count).start((warmup, run) -> {
while (true) {
int edgeId = rand.nextInt(maxEdgesId);
if (allowedEdges.contains(edgeId))
return graph.getEdgeIteratorState(edgeId, Integer.MIN_VALUE).getEdge();
}
});
print("unit_tests.get_edge_state", miniPerf);
}
Aggregations