[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 583: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 639: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
Gephi forums •Using RadialAxisLayout in toolkit?
Page 1 of 1

Using RadialAxisLayout in toolkit?

Posted: 10 Aug 2011 10:15
by markwoon
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.

Re: Using RadialAxisLayout in toolkit?

Posted: 10 Aug 2011 14:48
by eduramiba
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

Re: Using RadialAxisLayout in toolkit?

Posted: 10 Aug 2011 15:41
by admin
Hi,

The RadialAxisLayout is a plugin so not directly available in Gephi. See this page to use a plugin in the toolkit.

Re: Using RadialAxisLayout in toolkit?

Posted: 11 Aug 2011 00:30
by markwoon
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.

Re: Using RadialAxisLayout in toolkit?

Posted: 11 Aug 2011 13:21
by eduramiba
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

Re: Using RadialAxisLayout in toolkit?

Posted: 06 Oct 2011 06:09
by mgroeninger
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.)

Re: Using RadialAxisLayout in toolkit?

Posted: 09 Oct 2011 13:19
by eduramiba
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

Re: Using RadialAxisLayout in toolkit?

Posted: 11 Apr 2012 18:34
by kinjal
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

Re: Using RadialAxisLayout in toolkit?

Posted: 16 Apr 2012 01:10
by mgroeninger
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