|Subject:||Re: [igraph] Is it possible to use igraph in Java?|
|Date:||Sat, 4 Apr 2009 21:10:33 +0100|
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.
|[Prev in Thread]||Current Thread||[Next in Thread]|