Problem importing grpahml in igraph

Skip to first unread message

Rubens Yanes

Oct 29, 2023, 8:01:35 PM10/29/23
to visone-users
I need to import a network from Visone 2.26 to igraph in R to make some  calculations. But when I tried to import it , I got the following error:

Error in read.graph.graphml(file, ...) :
  At core/io/graphml.c:1443 : Graph index was too large, Invalid value

This is the command I am using (and it works fine with files from other softwares

X2011 <- read.graph("2011-act.graphml", format = "graphml")

Any hints about why this happened and how I could solve it?
I am attaching the graphml file I got from Visone.


Kimmo Elo

Oct 30, 2023, 2:12:26 AM10/30/23

I can reproduce this with my R on Linux Mint (with all updates). R
throws the same error, the file opens fine in visone.

I also tried to save the graph as GML in visone. With this file
igraph::read.graph terminates with another error:

--- snip ---
Error in read.graph.gml(file, ...) :
At core/io/gml.c:214 : Parse error in GML file, line 1 (syntax error,
unexpected LISTCLOSE, expecting KEYWORD), Parse error
--- snip ---

Is this now related to igraph or to visone? It seems that igraph is not
able to read graphs exported from visone, reason unknown to me.

Might be related to this, but I also found a similar problem reported
for Cytoscape. Since both are Java-based spplications, could this be
caused by a malfunctional Java library?



Müller Julian

Oct 30, 2023, 9:56:45 AM10/30/23
Hi all,

I spent some time investigating these two problems.

Regarding GraphML: I'm not sure why, but it seems igraph doesn't find the "graph" tag in the xml file, although it's clearly there when you open the file. I can't tell more without stepping through the igraph parser.

Regarding GML: There is one thing visone does wrong (but without consequences) and one thing igraph does wrong (which causes the parse error).

First, visone uses the "Version" field in the wrong way. But the igraph parser is written in such a way that it ignores visone's wrong use, so that's not what makes igraph fail to load the gml file.

Second, visone also outputs some empty lists in the GML format, but the igraph parser appears to expect all lists to be non-empty. This also fits with the parse error message (if lists are non-empty, then any list must start with "[ key", however, visone outputs some empty lists giving "[ ]"; so igraph expects a key, but encounters the list-closing character "]").

So I passed the following minimal GML file to igraph, defining a graph with zero nodes and links:

graph []

and parsing fails with the same error message.

I checked the original GML specification and it allows empty lists, so I think this is a bug in the igraph parser.


Müller Julian

Oct 30, 2023, 10:06:10 AM10/30/23
Hi all,

I wanted to report this bug to the igraph team, but they already fixed this in the core C code (see commit

However, the R package doesn't use the updated C code yet.

You received this message because you are subscribed to the Google Groups "visone-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Müller Julian

Oct 31, 2023, 6:52:04 AM10/31/23
Hi all,

Regarding GraphML: I did some more experiments and it seems to me that igraph's parser fails whenever it encounters a namespace it doesn't know on tags or attributes.
Once again, there have been many changes to igraph's GraphML parser in the underlying C code. These must make the parser handle namespaces more gracefully at least, because a test was added that reads a GraphML file with namespaces on tags and attributes.
However, these changes haven't made it into the R package yet.

Regarding GML: I fixed visone's wrong use of the Version field (although I'm not sure if any software actually refused to load visone-generated GML because of this particular problem). The fix will be included in the next release.


Reply all
Reply to author
0 new messages