Home Wiki Blog Forum GEXF.net

Gephi forums

Community support

Toolkit from commandline?

Automated tasks on server

Toolkit from commandline?

Postby bruce01 » 11 Sep 2013 11:40

Hi,

I am interested in using Gephi from commandline, I thought I might be able to run something like:

Code: Select all
java -jar gephi-toolkit.jar <script.js>


but I think this is not possible(?) Can anyone enlighten me? Netbeans doesnt seem to be the solution for me, does it have to be interactive? Really, I would like to be able to put Gephi at the end of my current pipeline to manipulate a GEXF of my results, returning a PDF or another GEXF.

Any help much appreciated, if someone can give me a basic walkthrough of what I need to do this, even better!
bruce01
 
Posts: 5
Joined: 04 Sep 2013 12:14

Re: Toolkit from commandline?

Postby pegerp » 11 Sep 2013 13:40

Hi Bruce.

There is no direct scripting support for Gephi Toolkit like that. It would be great if there was.

You need to create a Java program that utilizes Gephi Toolkit to accomplish what you require. For examples check the code examples at https://wiki.gephi.org/index.php/Toolkit_portal. The Headless Example most likely guides you through the steps that you'd want to have - open a graph file, modify graph, save graph.

Having Netbeans for using Toolkit is not directly a requirement but in practice if you don't know what you are doing it makes everything much more easier.
pegerp
 
Posts: 101
Joined: 21 Dec 2011 18:10

Re: Toolkit from commandline?

Postby bruce01 » 11 Sep 2013 14:06

Hi pegerp,

thanks for the reply. So there is no way I can build a Java module (not sure of Java nomenclature) to run off command line? I have written a java script based on the toolkit tutorial, but just can't get the Netbeans IDE to run it. At this stage I would have been quicker running in the GUI, but feel I invested this much time to trying out the toolkit it would be annoying not to get it working!
bruce01
 
Posts: 5
Joined: 04 Sep 2013 12:14

Re: Toolkit from commandline?

Postby pegerp » 11 Sep 2013 15:56

Hmm... I'm not completely sure what you are exactly looking for. It is possible to create a JAR that you can run off the command line. However you need to program the functionality in Java by yourself. In your Java program you use the Gephi Toolkit as you would any other Java library.

I have a one Gephi Toolkit utility that I'm using together with Perl and PHP. In it the PHP handles file upload via web form, then the Perl program notices that a new graph file is available and then executes the Java program with proper parameters. After the Java program has run I can refresh a webpage and see the graphical layout of the uploaded graph along with other info that Gephi computed and saved in files (exporting JSON and PNG images). If needed it would be possible to have a eg. Bash script to continue handling output from Gephi or the Perl program - that is, to pipe output to the next program.

In command line I can use my program like: java -jar MyProgram.jar -<parameters for the Java program>

The parameters that are given to the program are like -f(ilename), -v(erbosity), -o(utput directory). This is the stuff that you need to program in the Java program yourself.

Netbeans is just an IDE to make it easier to handle all that Java stuff. Netbeans compiles all necessary stuff into a directory structure of libraries and JAR files. I've modified some of the Gephi Toolkit modules myself so some modules are compiled into separate JAR files that override the functionality in the original Gephi Toolkit JAR file. Netbeans is really helpful with this kind of stuff.

Have you managed to compile your Java program and run it outside Netbeans? You also mention "java" and "script" so just to remind everyone that Java and JavaScript are completely unrelated programming languages and JavaScript has nothing to do with Gephi.
pegerp
 
Posts: 101
Joined: 21 Dec 2011 18:10


Return to Toolkit

Who is online

Users browsing this forum: No registered users and 0 guests