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
-
markwoon - Posts:6
- Joined:10 Aug 2011 09:40
[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
Using RadialAxisLayout in toolkit?
Post
by markwoon » 10 Aug 2011 10:15
Does anyone know if it's possible to use the RadialAxisLayout (from the Circular Layout plugin) from the toolkit?
I'm getting:
Code: Select all
java.lang.NullPointerException
at org.gephi.layout.plugin.circularlayout.radialaxislayout.RadialAxisLayout.goAlgo(RadialAxisLayout.java:121)
When I try to run:
Code: Select all
RadialAxisLayout layout = new RadialAxisLayout(new RadialAxisLayoutBuilder(), 10, false);
layout.setGraphModel(graphModel);
if (layout.canAlgo()) {
for (int i = 0; i < 100 && layout.canAlgo(); i++) {
layout.goAlgo();
}
}
I'm new to Gephi, so it's entirely possible I'm just not calling the layout properly. I'm just basing this of the example for running the YifanHuLayout. If this is wrong, how should I be invoking the layout to run on a graph?
Thanks.
-
eduramiba
- Gephi Code Manager
- Posts:1064
- Joined:22 Mar 2010 15:30
- Location:Madrid, Spain
[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
Post
by eduramiba » 10 Aug 2011 14:48
Hi,
Looking at RadialAxisLayout code, you have to call initAlgo() first so it gets the current graph from the graphModel. Indeed, initAlgo() should always be called with any layout so I edited the example
http://wiki.gephi.org/index.php/Toolkit_-_Layout_graph
You downloaded CircularLayout code to use it with gephi toolkit, I guess?
Eduardo
-
admin - Gephi Community Manager
- Posts:964
- Joined:09 Dec 2009 14:41
[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
Post
by admin » 10 Aug 2011 15:41
Hi,
The RadialAxisLayout is a plugin so not directly available in Gephi. See
this page to use a plugin in the toolkit.
-
markwoon - Posts:6
- Joined:10 Aug 2011 09:40
[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
Post
by markwoon » 11 Aug 2011 00:30
eduramiba wrote:
Looking at RadialAxisLayout code, you have to call initAlgo() first so it gets the current graph from the graphModel. Indeed, initAlgo() should always be called with any layout so I edited the example
http://wiki.gephi.org/index.php/Toolkit_-_Layout_graph
You downloaded CircularLayout code to use it with gephi toolkit, I guess?
Eduardo, I've tried it with initAlgo() as well and get the same results (NPE).
Here's a simple test case:
Code: Select all
//Init a project - and therefore a workspace
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
pc.newProject();
Workspace workspace = pc.getCurrentWorkspace();
//Get a graph model - it exists because we have a workspace
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
//Create three nodes
Node n0 = graphModel.factory().newNode("n0");
n0.getNodeData().setLabel("Node 0");
Node n1 = graphModel.factory().newNode("n1");
n1.getNodeData().setLabel("Node 1");
Node n2 = graphModel.factory().newNode("n2");
n2.getNodeData().setLabel("Node 2");
//Create three edges
Edge e1 = graphModel.factory().newEdge(n1, n2, 1f, true);
e1.getEdgeData().setLabel("Edge 1");
Edge e2 = graphModel.factory().newEdge(n0, n2, 2f, true);
e2.getEdgeData().setLabel("Edge 2");
Edge e3 = graphModel.factory().newEdge(n2, n0, 2f, true); //This is e2's mutual edge
e3.getEdgeData().setLabel("Edge 3");
//Append as a Directed Graph
DirectedGraph directedGraph = graphModel.getDirectedGraph();
directedGraph.addNode(n0);
directedGraph.addNode(n1);
directedGraph.addNode(n2);
directedGraph.addEdge(e1);
directedGraph.addEdge(e2);
directedGraph.addEdge(e3);
RadialAxisLayout layout = new RadialAxisLayout(new RadialAxisLayoutBuilder(), 10, false);
layout.setGraphModel(graphModel);
if (layout.canAlgo()) {
layout.initAlgo();
for (int i = 0; i < 100 && layout.canAlgo(); i++) {
layout.goAlgo();
}
layout.endAlgo();
}
Yes, I'm using the latest version of the Circular Layout plugin, downloaded yesterday.
-
eduramiba
- Gephi Code Manager
- Posts:1064
- Joined:22 Mar 2010 15:30
- Location:Madrid, Spain
[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
Post
by eduramiba » 11 Aug 2011 13:21
Hi,
The NPE is probably because some properties are null.
Call it always in the exact same order as here
http://wiki.gephi.org/index.php/Toolkit_-_Layout_graph:
initAlgo right after setModel
Reset properties (or set every property with a desired value)
Run the algorithm
Eduardo
-
mgroeninger - Gephi Plugin Developer
- Posts:8
- Joined:29 May 2011 20:30
- Location:Boulder, CO
[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
Post
by mgroeninger » 06 Oct 2011 06:09
Sorry to post on a topic that is so old but I haven't been paying attention.
Mark, did you get this working? And is there any way I can see a peek at what you are doing? (I'm curious about the uses people find for the Radial Axis layout.)
Eduardo, is there anything my plugin should be doing to check for unset/null properties? (I've done a bit, but I have not been thorough.)
-
eduramiba
- Gephi Code Manager
- Posts:1064
- Joined:22 Mar 2010 15:30
- Location:Madrid, Spain
[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
Post
by eduramiba » 09 Oct 2011 13:19
I guess there is no problem using it with the GUI because properties are reset.
But maybe do a reset in the constructor just to avoid null intial values.
Eduardo
-
kinjal - Posts:3
- Joined:15 Dec 2011 20:09
[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
Post
by kinjal » 11 Apr 2012 18:34
I have a quick question: I have a network I want to visualise using radial axis; when I group nodes according to degree I get axes but if I sort according to modularity I only get a circular layout and the axes disappear. I want my modules to be sorted as axes. Any idea how I can fix this?
Thanks
-
mgroeninger - Gephi Plugin Developer
- Posts:8
- Joined:29 May 2011 20:30
- Location:Boulder, CO
[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
Post
by mgroeninger » 16 Apr 2012 01:10
kinjal wrote:I have a quick question: I have a network I want to visualise using radial axis; when I group nodes according to degree I get axes but if I sort according to modularity I only get a circular layout and the axes disappear. I want my modules to be sorted as axes. Any idea how I can fix this?
Thanks
Hi Kinjal,
Any time I have seen this it is the result of each node being ranked separately. I would recommend you check the modularity in the data laboratory to see if this is the case.
Also, it probably makes more sense to create a new thread rather than post at the end of multuple old threads.
Thanks,
Matt
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