[SOLVED] Fastest algorithm for beginners

Algorithms and parameters to put data in space
yannis
Posts:11
Joined:24 Dec 2011 14:24
Location:Brest, France
Contact:
[SOLVED] Fastest algorithm for beginners

Post by yannis » 24 Dec 2011 16:02

dear Gephi users,

I have a graph of 18,686 nodes and 39,719 edges I want to explore.
When I open it, I get a big square area full of vertices, like a box filled with pepper corns.
I tried to obtain a better layout using Force Atlas, after 3 hours it hasn't done anything, so
I stopped. Is there some "poor man's" algorithm which is faster and still produces some
reasonable layout?

Is there some way to know in advance how much time the layout will take?

I'm working on a MacBook Air 1.7 GHz Intel Core i5 with 4 GB of RAM.

Can I do some of the calculations on a Linux box which is *much* faster and has about 80
times more RAM, but for which I have no graphic interface access, only console?

Thank you very much in advance and merry Christmas,

Yannis Haralambous

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: Fastest algorithm for beginners

Post by eduramiba » 27 Dec 2011 00:58

Hi,
You can use Force Atlas, which is better and faster, and enable the barnes-hut approximation if necessary to speed up calculations.

If you needed to use gephi without a graphic interface, you could code your graph calculations and output using the gephi toolkit https://gephi.org/toolkit

Eduardo

yannis
Posts:11
Joined:24 Dec 2011 14:24
Location:Brest, France
Contact:

Re: Fastest algorithm for beginners

Post by yannis » 27 Dec 2011 20:41

Thanks for your answer.
Do you mean Force Atlas or Force Atlas 2?
Where do I enable barnes-hut approximation? I couldn't find it in the Spatialization panel…

The code for the toolkit looks very scary (I confess I never liked Java, do all my programming in Perl).
All I want is:
1) open a graph stored in a GEXF file
2) colorize vertices according to the frequency attribute of the GEXF file, from blue to red (values 0 to 24.6754)
3) increase size of vertices according to out-degree, from size 4 to size 36.5 (values 0 to 992)
4) apply Force Atlas (or Force Atlas 2, depending on your answer to my first question) to it
5) save the result in a file from which I can open it on my Mac.

Maybe steps 2 and 3 can be done on the Mac and the Linux box does only the Force Atlas?
In that case how would be the code?
Thanks in advance

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: Fastest algorithm for beginners

Post by eduramiba » 27 Dec 2011 23:20

Sorry I meant Force Atlas 2.
For the approximation check the "Approximate Repulsion" option.

You can try to increase the memory as explained in the other topic, and do everything with graphical interface.
But if you go with the toolkit, yes, you could do everything but the layout in gephi and save the file.
Then just open it with the toolkit, apply layout and export the file.

Here https://wiki.gephi.org/index.php/Toolki ... less_Gephi you have an example on how to open the file, apply layout and some other things. Or exporting https://wiki.gephi.org/index.php/Toolkit_-_Export_graph

Eduardo

yannis
Posts:11
Joined:24 Dec 2011 14:24
Location:Brest, France
Contact:

Re: Fastest algorithm for beginners

Post by yannis » 28 Dec 2011 21:26

I can't launch gephi on the Linux server since there is no X display, I guess that is normal/

I downloaded the toolkit and opened it. In the README.md file it says:
> Open the project in Netbeans IDE.
> - Each demo is independent from each other.
> - Run demos by calling script() method.
> - Change the main class to execute a demo

I don't have Netbeans IDE and I don't know how to run an IDE without a GUI. I don't know that script() method neither what you mean by changing the main class… :(

Could you please simply tell me:
1) what do I need to write in the *.java file
2) what options do I need for javac and java so that it loads the JAR package and knows where gephi is located.

I simply want to run gephi on a Linux machine (which has dozens of processors and hundreds of gigabytes of RAM, but no GUI, no display), I'm not proficient in Java and don't want to develop any application. Please give me just the necessary instructions for the frame in which I will write the code provided in the tutorials.Please do as if I had no experience whatsoever with Java.

Thanks in advance (I'm sure other users will find this useful as well, not everybody can program in Java)

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: Fastest algorithm for beginners

Post by eduramiba » 29 Dec 2011 15:58

Hi,

You can compile and run java from the command line.

I attach some short java code to run Force Atlas 2 for a file called "graph.gexf".
At the beginning of the file, you can set some force atlas 2 properties under //Layout constants. The others will be default.

I included scripts for compiling and running the code, but you will need to download gephi-toolkit.jar and place it at lib directory.
Attachments
graph layout.zip
(2.52KiB)Downloaded 368 times

yannis
Posts:11
Joined:24 Dec 2011 14:24
Location:Brest, France
Contact:

Re: Fastest algorithm for beginners

Post by yannis » 29 Dec 2011 23:30

Thank you so much!!
Just another four tiny questions:
1) THREADS_COUNT=3, if the machine has 32 processors, can I put THREADS_COUNT=32 ?
2) do I need to change gephi.conf so that gephi uses a maximum of memory, or will this happen automatically?
3) well understood I can change the color of nodes afterwards, but how about the size? Does the size of nodes affect Force Atlas 2 or not?
4) your code saves the result in GEXF format, does this format keep all the necessary layout information or should I better save the file in GEPHI format?
You have been very helpful and I'm extremely grateful! (sorry for taking so much of your time…)

yannis
Posts:11
Joined:24 Dec 2011 14:24
Location:Brest, France
Contact:

Re: Fastest algorithm for beginners

Post by yannis » 29 Dec 2011 23:51

Unfortunately when I run
/usr/local/java/bin/javac -cp lib/gephi-toolkit.jar graphlayout/Main.java
I get the reply:
Note: Attempting to workaround javac bug #6512707
and no file is created…
Any idea what this means and whether it can be fixed?

Here is my javac version: javac 1.6.0_21

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: Fastest algorithm for beginners

Post by eduramiba » 30 Dec 2011 00:31

Don't worry, I get that message too.
The created file will be Main.class under graphlayout directory.
Just execute run.sh after.

Eduardo

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: Fastest algorithm for beginners

Post by eduramiba » 30 Dec 2011 00:50

yannis wrote:Thank you so much!!
Just another four tiny questions:
1) THREADS_COUNT=3, if the machine has 32 processors, can I put THREADS_COUNT=32 ?
2) do I need to change gephi.conf so that gephi uses a maximum of memory, or will this happen automatically?
3) well understood I can change the color of nodes afterwards, but how about the size? Does the size of nodes affect Force Atlas 2 or not?
4) your code saves the result in GEXF format, does this format keep all the necessary layout information or should I better save the file in GEPHI format?
You have been very helpful and I'm extremely grateful! (sorry for taking so much of your time…)
1) Yes it is possible
2) Now you run your own java application. So increase memory adding-Xms128m -Xmx1500m for example to the command in run.sh like

Code: Select all

java -cp "lib/gephi-toolkit.jar;." -Xms128m -Xmx1500m graphlayout.Main
3)Node sizes affect Force Atlas 2 only if you set adjust sizes to true. So, if you want to use this option, you should rank sizes of your nodes in gephi desktop before running the layout in the console.
4)GEXF contains position information of the nodes and most things you will need. A .gephi file is like a project file that is able to contain several workspaces, extra information like saved parameters for overview and preview, filters... You could use a .gephi file if you need it in the future

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