Ranking modularity Java.lang.NullPointerException

Once it's running
ivancorme
Posts:8
Joined:28 Aug 2016 12:21
[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
Ranking modularity Java.lang.NullPointerException

Post by ivancorme » 28 Aug 2016 12:48

Hi,

I am doing Gephi programming using the Toolkit and I have been able to successfully run the example programmes that are hosted in github (https://github.com/gephi/gephi-toolkit- ... lkit/demos).

I am facing problems with the partition by modularity class. I am able to run the program with the file polblogs.gml which is used in most of the examples but when I try to do the partition with a graphml file that I have I get an error with NullPointerException at this line 124:

Function func2 = appearanceModel.getNodeFunction(graph, modColumn, PartitionElementColorTransformer.class);

I have done debugging and cannot find the problem.

Can anybody tell what may be going on??. There must be a small detail which I must be missing.

I have uploaded a zip with the the programmes and both network files. The one creating the problem is called network.graphml

Thanks,

Ivan
Attachments
partition_gephy.tar.gz
All files necessary to reproduce the problem
(105.63KiB)Downloaded 58 times

User avatar
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

Re: Ranking modularity Java.lang.NullPointerException

Post by eduramiba » 28 Aug 2016 15:18

Your files don't have the "modularity_class" column, so modColumn is null.

ivancorme
Posts:8
Joined:28 Aug 2016 12:21
[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: Ranking modularity Java.lang.NullPointerException

Post by ivancorme » 28 Aug 2016 20:13

Hi eduramiba,

Thanks for answering.

The problem is not that. The modularity class column is created in the code. The problem comes when func2 is created. If I run the code loading the polblogs.gml file, I have not problems and everything works well. The problem comes when I run it with the network.graphml file. For some reason, the func2 points to null (I checked with the debugger) when its created. So it has to be something that have to do with the files. Any problems loading and applying modularity go graphml files??

Ivan

I am quite lost at this point.

User avatar
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

Re: Ranking modularity Java.lang.NullPointerException

Post by eduramiba » 28 Aug 2016 21:26

Oh right, didn't see that, sorry.

The code seems correct according to https://github.com/gephi/gephi-toolkit- ... Graph.java so it might be a bug.
Looking at https://gephi.org/gephi-toolkit/0.9.1/a ... lImpl.html can you try to call getNodeFunctions and getNodePartition to see what is returned?

ivancorme
Posts:8
Joined:28 Aug 2016 12:21
[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: Ranking modularity Java.lang.NullPointerException

Post by ivancorme » 29 Aug 2016 15:26

Hi,

I have run the programmes and I get:

getNodeFunctions --> I get the modularity functions which seems to be ok with both examples.

getNodePartition --> In this one is where I get the problem. With the files like polblogs.gml from the web examples (I tried running the misserables example too and it works) I get the node partition object. However, with the examples that do not work, I get a null object. I have uploaded the image with the debugger. What is going on there...?? I do not know.

I checked the modularity object and in all cases the modularity is performed correctly (I have checked with the debugger against the results obtained using the Gephi GUI version). With the GUI version all examples work.

I tried to modify and reduce the example from lesmisserables to two nodes and it does not run using the toolkit (the full example from the web works correctly).

The function getNodePartition is called with the graph and a column may be there the problem?? I checked both and they look ok.

Any more ideas??

Thanks,

Ivan
Attachments
getNodePartition.png
debugg of getNodeParition with null

User avatar
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

Re: Ranking modularity Java.lang.NullPointerException

Post by eduramiba » 29 Aug 2016 16:10

It's possible that the new appearance API does not detect modularity as a partition column.
Are your modularity results giving a lot of communities. Not sure about this though.

ivancorme
Posts:8
Joined:28 Aug 2016 12:21
[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: Ranking modularity Java.lang.NullPointerException

Post by ivancorme » 29 Aug 2016 17:43

I think there must be something that has to do with the edges. I have tried my network file generated with more edges and it works. Is there any limitation/problem on that when using the partition functions??. Because when I use the GUI gephi with the my network that contains only a few number of edges it works but not with the toolkit.

Regarding your question, the number of communities is small and seems to be calculated correctly.

ivancorme
Posts:8
Joined:28 Aug 2016 12:21
[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: Ranking modularity Java.lang.NullPointerException

Post by ivancorme » 29 Aug 2016 18:02

One thing to notice. The networks that work a call to getNodeFunctions after running the

modularity.execute(graphModel);

returns multiple 'Modularity Class' instances. Check in the file attached called 'wrong'.

On the other hand, when the network works, after that line there is only one 'Modularity Class' returned by getNodeFunctions. Check the file attached called 'working' .

I think that there must be at least a problem. Why the call to modularity.execute generate multiple 'Modularity Class' function instances???

Ivan
Attachments
working.png
debugging of network working only generates one modularity class
wrong.png
debugging of network NOT working generates multiple modularity class

ivancorme
Posts:8
Joined:28 Aug 2016 12:21
[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: Ranking modularity Java.lang.NullPointerException

Post by ivancorme » 29 Aug 2016 18:24

I think I found the problem. After

modularity.execute(graphModel);

The networks causing a problem generate multiple modularity class attribute functions with generator 'ranking' and the ones that work generate a single one with transformer 'partition'. Check the images. These follows what you mentioned before and seems that the new appearance API does not detect modularity as a partition column and does it as ranking...

The weird thing is that with the GUI all this works.

Why this is happening and how do I fix this to always produce partition generator when applying the modularity.execute??

Ivan
Attachments
right_partition.png
wrong_ranking.png

User avatar
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

Re: Ranking modularity Java.lang.NullPointerException

Post by eduramiba » 29 Aug 2016 19:42

I think this is related to https://github.com/gephi/gephi/issues/1459 and appearance API needs a few fixes. Maybe you can force partition mode for that column with the API?

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