Sorry for a noob question, I just try to make sure I’m not doing anything stupid here.
So I’m currently testing a graph contraction performance, here’s my code:
GraphHopperStorage g = createGHStorage();
CHGraph lg = g.getGraph(CHGraph.class);
SecureRandom rand = new SecureRandom();
// A random graph of ~10000 vertexes and ~30000 edges
for (int i = 0 ; i < 30000 ; i++) {
int node1 = rand.nextInt(10000);
int node2 = rand.nextInt(10000);
if (node1 == node2) continue;
g.edge(node1, node2, 1 + rand.nextInt(20), false);
}
g.freeze();
long time = System.currentTimeMillis();
// Contract the graph
PrepareContractionHierarchies prepare = new PrepareContractionHierarchies(dir, g, lg, weighting, tMode);
prepare.doWork();
System.out.println("Contraction took: " + (System.currentTimeMillis() - time));
It takes about 20 minutes on my computer to get this done. Is this awfully long? If times like this are expected, is there a way to speed it up?