Ranking modularity Java.lang.NullPointerException
-
- 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
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
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
- 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
Your files don't have the "modularity_class" column, so modColumn is null.
-
- 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
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.
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.
- 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
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?
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?
-
- 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
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
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
- 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
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.
Are your modularity results giving a lot of communities. Not sure about this though.
-
- 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
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.
Regarding your question, the number of communities is small and seems to be calculated correctly.
-
- 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
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
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
-
- 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
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
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
- 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
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?