I just came up with a new implementation idea.
...If you don't want to start writing yet :p
At the moment you are just appending the edges.
By sorting the edges by node-ids, we could increase the probability of cache-hits: imagine a node with edges to n5, n6, ..., n3000.
If the edges are sorted, we would access n6 after n5. Since they are neighbors the probablity is very high that n6 is already in our cache ;)
Would be interesting to see how big this effect is.
You could call std::sort on all edge-lists after building the graph.
Just add a method sortByEdgesByNodeId to the graphs and run the benchmarks once with/and once without sorting the edges.
I just came up with a new implementation idea. ...If you don't want to start writing yet :p
At the moment you are just appending the edges. By sorting the edges by node-ids, we could increase the probability of cache-hits: imagine a node with edges to n5, n6, ..., n3000. If the edges are sorted, we would access n6 after n5. Since they are neighbors the probablity is very high that n6 is already in our cache ;)
Would be interesting to see how big this effect is. You could call std::sort on all edge-lists after building the graph. Just add a method sortByEdgesByNodeId to the graphs and run the benchmarks once with/and once without sorting the edges.