What is the idea of sortGraph?

Hi,

It seems GH sort the nodes of graph by DepthFirstSearch.
I don’t know why this will optimize the graph.
What is idea here?
Thanks.

The idea is that sorting increases the probability that ‘next nodes’ lay also close in memory. And there are complex algorithms like Z curve or hamiltonian curve, but DFS is a lot easier to implement and gives a similar if not better speed boost at least for GH and at the time I compared this.

Hi,

It seems this optimization only works for MMAP, usually for embedded device.
If we put everything inside the memory, this optimization is useless.
Am I right?

Just try it and you’ll see that there are advantages for the RAM setting too, due to CPU cache advantages. But it is not the default …

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.