Layout nodes to grid after import of more than 5000 nodes #746

Open
wants to merge 1 commit into
from

3 participants

@libor-m

After importing of a large graph (200K nodes), the application was hung for several minutes (!). But working with the laid out graph was quite smooth.

Profiling revealed, that the hot spot is in OpenGL backed node rendering. My guess was that the reason is node overlaps and Z sorting.

After implementing this fix, the same graph is 'operable' in about 30 seconds. Nothing substantial in the code, but indispensable for real use of the program.

Libor Morkovsky layout nodes to grid after import for more than 5000 nodes, to avoid …
…node overlaps that kill performance of gl rendering
c805cca
@sheymann
Gephi member

Interesting issue, however the random positions are important: most of layouts are sensitive to initial node positions. I'm also not sure if this is an issue of your graphic card, as I don't have this problem on my laptop dealing with large graphs.

What is your graphic card and drivers?

@libor-m

The affected machine, I guess it's 307.45 Nvidia drivers.

NVIDIA Corporation
Quadro 400/PCIe/SSE2
OpenGL 3.3.0

I've tested this on another computer, and it's flawless. It has old 260.xx Nvidia drivers.

NVIDIA Corporation
GeForce GT 330/PCI/SSE2
OpenGL 3.3.0
@libor-m

If the randomness could be harmed by order of the nodes in the input file, what about randomly placing nodes on a grid. At least as an import option, for such buggy cards/drivers...

@mbastian
Gephi member

Hi, that sounds a reasonable fix. I actually think that for large graphs an initial position with a larger scale can't hurt.

As you may know Gephi's rendering engine works with a Octree so the space is partitioned in quadrant. When you randomize on a larger scale you're also reducing the number of nodes in a single quadrant, which is a good thing. For instance when moving your mouse around, we would only try collision between the mouse coordinate and the nodes in the same quadrant so the less nodes per quadrant the better.

Can you be more specific about the profiling? I'm interested to learn more about your findings.

@libor-m

Hi, currently I don't have time to work on this, but when I get back to it, I'll send you some details on the profiling.

To the random positions on the grid - does Fisher-Yates shuffle look reasonable to you? I'd place the nodes to a grid in order given by the calculated permutation. It is O(n), so it should not do much harm in the loading. I'll implement this when I get back to work on Gephi, if you're ok with it.

@mbastian mbastian was assigned Mar 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment