Correct way of adding edges to existing graph

Extensions and customization
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
HamPlanet
Posts:10
Joined:04 May 2013 17:51
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Correct way of adding edges to existing graph

Post by HamPlanet » 03 Apr 2014 14:55

Hi, is there a way of adding edges to existing graph which is fast and is not constantly updating visible graph ?
My scenario is:
1. My plugin creates a graph that have 65k nodes and 0 edges, every node have some custom attributes
2. User filters the graph to about 10k nodes and 0 edges (by nodes attributes)
3. User sets some parameters and run algorithm to add edges
4. Algorithm takes getUndirectedGraphVisible() from graph model and runs LongTask that creates edges

It looks like this:
Graph g = graphModel.getUndirectedGraphVisible();
NodeIterable ni = g.getNodes();
nodes = ni.toArray();
graph = graphModel.getUndirectedGraph();

for (iterate nodes)
if (condition to create edge between two nodes)
graph.addEdge(graphModel.factory().newEdge(source, target, value, false));

But it is pretty slow and it is constantly updating view - wich is not needed until all edges are created, it is also using a lot of memory.
Thanks.

HamPlanet
Posts:10
Joined:04 May 2013 17:51
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Correct way of adding edges to existing graph

Post by HamPlanet » 03 Apr 2014 15:05

I tested it again and problems starts when i have around 200k edges it appers as if gephi is constantly filtering graph - i can see it in the right bottom corner of gephi, is it because my current view is filtered ? As i said i create a graph with 65k nodes filter it down to about 10k nodes with range filter and run my algorithm.

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable