igraph-help
[Top][All Lists]
Advanced

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

[igraph] trouble with attaching attributes in python igraph


From: Eytan Bakshy
Subject: [igraph] trouble with attaching attributes in python igraph
Date: Tue, 8 Jul 2008 21:23:55 -0400

Hello,

I have been using the attribute functionality of python igraph and ran into a few issues when attaching vertex and edge attributes:

If you do not specify n ahead of time, it seems like edge attributes and vertex attributes do not get set.

For example if I do:
  g = Graph([(0,1),(1,0)],edge_attrs={'a':[1,2]})
g.es.attribute_names() is empty,

but if I do:
  g = Graph(2, [(0,1),(1,0)],edge_attrs={'a':[1,2]})
g.es.attribute_names() has 'a'.

The same seems to hold true for vertex_attrs as well.  I have a feeling that this has to do with shifting the parameters in Graph.__init__(), but I don't understand exactly how optional arguments work in python...


Also, if you pass a tuple instead of a list as a key of an attribute, python crashes with a Bus Error:
  g = Graph(2,[(0,1),(1,0)],edge_attrs={'a':(1,2)})


Thanks,

-eytan

reply via email to

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