igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] smooth interaction between igraph/R and networkx/python


From: Gábor Csárdi
Subject: Re: [igraph] smooth interaction between igraph/R and networkx/python
Date: Thu, 6 Dec 2012 09:42:08 -0500

On Thu, Dec 6, 2012 at 9:11 AM, Bob Pap <address@hidden> wrote:
[...]

> g_new <- read.graph(MyFile("folder", "data", "g_new.gml"),"gml")

Error in read.graph.gml(file, ...) : 

  At foreign.c:1114 : Parse error in GML file, line 1 (syntax error, unexpected LISTCLOSE, expecting KEYWORD), Parse error

This is because some keys in the GML file include a 'dot' character, and that is not allowed in GML. I consider that this as a NetworkX bug.

> g_new <- read.graph(MyFile("folder", "data", "g_new.net"),"pajek")

Error in read.graph.pajek(file, ...) : 

  At foreign.c:578 : Parse error in Pajek file, line 1 (syntax error, unexpected ALNUM), Parse error

This is because the Pajek file has a lot of extra vertex/edge arguments that are not allowed according to the Pajek manual. (Or they are at least undocumented.) I don't know what Pajek itself does with these, maybe just ignores them. I think this is also a NetworkX bug. See also:
https://networkx.lanl.gov/trac/ticket/542

> g_new <- read.graph(MyFile("interbank", "data", "g_new.graphml"),"graphml")

This seems to work fine.

igraph could give better error messages of course, and give the correct line number of the error at least. 

Also, possibly we could do a workaround and ignore extra attributes in Pajek files, but I'll try to open this file with Pajek as well, and if Pajek does not open it, then we don't want to with igraph, either.

Best,
Gabor
 



On 6 December 2012 12:06, Tamas Nepusz <address@hidden> wrote:
> forth (incidentally, igraph is not able to read the gml and pajek graphs
> exported from networkx).
Can you please send me a few example graphs produced by NetworkX that cannot
be read by igraph?

> However, a bit ahead I am going to have to do the back-and-forth between
> igraph/R and networkx/python for many graphs. Is anybody familiar with
> tricks to implement this in code?
The only trick that comes into my mind is that if you want to avoid having
to jump back and forth between an R console and a Python console, you could
try RPy (http://rpy.sourceforge.net), which aims to bridge the gap between
the two languages. Note that R and Python still live in their separate
worlds, RPy just gives you tools to pass basic variables between them.
(Passing igraph graphs directly won't work, though).

--
T.

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help


_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help




--
Gabor Csardi <address@hidden>     MTA KFKI RMKI


reply via email to

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