igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Is it possible to use igraph in Java?


From: Laurence Muller
Subject: Re: [igraph] Is it possible to use igraph in Java?
Date: Tue, 07 Apr 2009 10:26:51 +0200
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)

Hi Tamas,

unfortunately I do not have a lot of experience with SWIG. In our department we only used it for our special software and a colleague used it to wrap OpenSceneGraph (!). It shouldn't be too hard to write a basic interface file and let SWIG take care of the rest....

Tamas Nepusz wrote:
Hi Laurence,

A possible way to (ab)use igraph in Java would be SWIG (Simplified Wrapper and Interface Generator). SWIG connects programs written in c/c++ with many high-level programming and scripting languages. It should be able to wrap all igraph functions and structures.
I took a quick look at SWIG - it looks quite sophisticated, but I'm worried about a few things. First, it looks like it maps C functions to static methods inside a special "module" class in Java, which means that all igraph_* functions would become static methods of the generated igraph module instead of instance methods of a generated Graph class. I don't know if there's a way to tell SWIG to map specific functions to instance methods of a given class instead. Second, every igraph function returns an error code and the actual result is returned as an output argument instead. (There might even be multiple output arguments for the same function; i.e., igraph_isomorphic_vf2 can return a yes/no answer and a mapping between the vertices of the two graphs if they are isomorphic). I'm not sure how to handle this in Java. Obviously, igraph error codes should be converted to exceptions and if there is only one output argument for a function, then that single argument should be returned in Java as a return value, but can SWIG do that automatically? If anyone in the list has ever used SWIG before, I'd be interested to hear your thoughts about that.



--
------------------------------------------
Laurence Muller (M.Sc.)
Informatics Institute, Faculty of Science, Universiteit van Amsterdam.
Science Park 107, 1098 XG Amsterdam, The Netherlands

Website/Blog/Portfolio:
1. http://www.multigesture.net/
2. http://www.science.uva.nl/~lmuller/

E-mail: address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]