|
From: | Tamas Nepusz |
Subject: | Re: [igraph] Python bindings issue |
Date: | Tue, 3 Jun 2008 22:29:29 +0200 |
Dear Filip,
The vertex_attrs dictionary should map attribute names to the list of attribute values. If you use the dictionary above, igraph does not know the attribute name to which it should map the nodes[] array. A better solution is this:# create the vertex_attrs dictionary vattrs = {0:nodes[0],1:nodes[1],2:nodes[2]}
>>> vattrs = {"node": nodes}This maps the "nodes" list (or more precisely a shallow copy of that) to an attribute called "node":
>>> g = Graph(n=2, edges=[(0,1),(0,2)], directed=True, vertex_attrs=vattrs)
>>> print g.vs["node"][<__main__.Node instance at 0x192a3a0>, <__main__.Node instance at 0x192a300>, <__main__.Node instance at 0x192a378>]
-- Tamas
[Prev in Thread] | Current Thread | [Next in Thread] |