gephi-toolkit icon indicating copy to clipboard operation
gephi-toolkit copied to clipboard

Issue with Modularity

Open Jonty800 opened this issue 7 years ago • 18 comments

I'm reading a .gexf and loading 126 nodes with 378 edges. I'm then trying to perform Modularity: Modularity modularity = new Modularity(); modularity.setRandom(true); modularity.setUseWeight(true); modularity.setResolution(0.8); modularity.setProgressTicket(ticket); modularity.execute(graphModel);

However, the algorithm hangs. Inside ProgressTicket, only start() is called and finish() is never called. It hangs for about 2 minutes and then stops "Process finished with exit code 0". - No errors.

What is going on here?

Jonty800 avatar May 05 '17 20:05 Jonty800

Hi, this is already reported at https://github.com/gephi/gephi/issues/1630 and is in the list of priority fixes.

eduramiba avatar May 05 '17 21:05 eduramiba

Oh I see. It works perfectly in the desktop application, just not in the toolkit.

Do you have any suggestions on how I could maybe get it to work? If I can automate the modularity it would speed my work up a lot :)

Jonty800 avatar May 05 '17 21:05 Jonty800

We still need to find the bug, though it should not work for you in desktop app either. You can try to avoid parallel edges, since maybe this is other bug already fixed in desktop but not released in toolkit.

eduramiba avatar May 05 '17 21:05 eduramiba

I use a java program to build my .gexf and use this file for both the toolkit and the app. I'll run some more tests tomorrow, and ensure there are no parallel edges. Thanks for the help!

Jonty800 avatar May 05 '17 21:05 Jonty800

I've opened my .gexf in the Gephi app (0.9.1) and I can see that it is merging the parallel weights. I then save this file from Gephi app to a new .gexf.

When I use this new .gexf, the hanging issue still occurs and finish() is never called.

I can't identify why the Gephi app works, and the toolkit does not.

I hope this helps - good luck with the bug :)

Jonty800 avatar May 06 '17 17:05 Jonty800

That's strange, can you show your java code? Or compare with this example https://github.com/gephi/gephi-toolkit-demos/blob/master/src/main/java/org/gephi/toolkit/demos/HeadlessSimple.java

eduramiba avatar May 07 '17 11:05 eduramiba

Sure: https://gist.github.com/Jonty800/d284ff55fb55cd42bb49622b90052ba9

The ProgressTicket just prints out some lines so that I can identify which method is being called.

Jonty800 avatar May 07 '17 13:05 Jonty800

Mmm can you try to pass the graphModel instead of graph like in https://github.com/gephi/gephi-toolkit-demos/blob/master/src/main/java/org/gephi/toolkit/demos/PartitionGraph.java ?

eduramiba avatar May 07 '17 13:05 eduramiba

Yup, I tried with both graph and graphModel since you can use either. The same happens with both.

Jonty800 avatar May 07 '17 13:05 Jonty800

I see, you can also try to use the latest 0.9.2 snapshot build:

https://github.com/gephi/gephi-toolkit#nightly-builds-092-snapshot

eduramiba avatar May 07 '17 13:05 eduramiba

I tried this a couple of days ago with gephi-toolkit-0.9.2-20170504.212034-186-all - same thing

Jonty800 avatar May 07 '17 13:05 Jonty800

Ok, will you mail me your test file for reproducing it please? Or attach a zip here if you can

eduramiba avatar May 07 '17 13:05 eduramiba

gephi files.zip

Sure -> here is the .gexf produced by my java code, and the same file but opened and then saved by gephi

Jonty800 avatar May 07 '17 14:05 Jonty800

Thanks! I will check it later

eduramiba avatar May 07 '17 14:05 eduramiba

This seems to work with latest toolkit 0.9.2-SNAPSHOT. Can you also test it please?

eduramiba avatar Aug 10 '17 19:08 eduramiba

Sorry for the late reply, it's been a while since I've needed to use Gephi.

I've been testing the 0.9.3-SNAPSHOT of the toolkit and I seem to get the same problem (only start() method is called, and then it hangs).

My gexf is created using java code only. There are duplicates (A vs B, B vs A), as you can see, for edges:

https://gist.github.com/Jonty800/f8a04904857fa0187ae3686c15fe7f09

Any thoughts?

Jonty800 avatar Apr 08 '18 16:04 Jonty800

I modified the Gephi code for Modularity.java and stopped it from being asynchronous. I did this by removing

implements Statistics, LongTask

and all associated code from these packages:

import org.gephi.statistics.spi.Statistics; import org.gephi.utils.longtask.spi.LongTask; import org.gephi.utils.progress.Progress; import org.gephi.utils.progress.ProgressTicket;

The class now works. I hope this helps you identify the bug.

https://gist.github.com/Jonty800/999425fbc1061fc2721ad4fc202b8175

Jon

Jonty800 avatar Apr 09 '18 18:04 Jonty800

I have experienced the same issue too with multiple threads involved. I thought it was related to the mess of projects/workspaces, but I will give the above tricks @Jonty800 has provided a try and provide updates soon. Finger crossed :)

liuqiyuan avatar Aug 23 '19 21:08 liuqiyuan

Closing old issue. I can't reproduce it. Feel free to reopen with additional details. I've added a label on https://github.com/gephi/gephi/issues/1630 to check whether this is still happening.

mbastian avatar Mar 17 '23 20:03 mbastian