Hello,
I have a problem when storing graphs as graphml files using the python
igraph library.
It seems that when I store a graph as a graphml file, all the attributes
that are based on python dictionaries are lost.
Let's say I have a graph like the following:
>>> import igraph
>>> g = igraph.Graph()
>>> g['dict_attribute'] = {1:2, 3:4}
>>> g['string_attribute'] = 'dsadsadas'
This graph has two attributes, one is a string and one is a dictionary. But
when I try to store it as a graphml file, the dict_attribute is lost:
>>> g.write_graphml('mygraph.graphml')
>>> g_loaded = igraph.read('mygraph.graphml')
>>> g_loaded.attributes()
['string_attribute']
What's happening? Why 'dict_attribute' is missing? It seems that the
problem is in the write_graphml function, because if I open the file
mygraph.graphml, dict_attribute is not there.
In the 0.5.4 version, dictionary attributes were stored as strings, and I
could retrieve them using the ast.as_literal function.
I am using igraph 0.6 and the python library python-igraph-0.6, which is
the one that is installed automatically by easy_install.
Thank you very much in advance,
Gio
--
Giovanni Dall'Olio, phd student
IBE, Institut de Biologia Evolutiva, CEXS-UPF (Barcelona, Spain)
My blog on bioinformatics: http://bioinfoblog.it
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help