On Fri, Dec 12, 2008 at 12:11 PM, Tamas Nepusz
<address@hidden> wrote:
> Is there a way to include weights in the output to graphml?
Yes. Assign them to an edge attribute and save the graph.
> Also, does igraph import weights from graphml?
Yes, simple numeric and string attributes are imported.
E.g. (in ipython):
In [1]: g=Graph.GRG(100, 0.2)
In [2]: import random; g.es["weight"] = [random.random() for _ in g.es]
In [3]: g.es["weight"] = [random.random() for _ in g.es]
In [4]: g.save("test.graphml")
In [5]: g2 = load("test.graphml")
In [6]: print g2.es["weight"][0:10]
[0.99729599999999996, 0.013597700000000001, 0.14432700000000001,
0.098399899999999998, 0.30777599999999999, 0.215923,
0.29499399999999998, 0.74816700000000003, 0.435998, 0.40986600000000001]
--
Tamas
_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help