[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] how to build a bipartite graph with python
From: |
Simone Gabbriellini |
Subject: |
Re: [igraph] how to build a bipartite graph with python |
Date: |
Tue, 18 Jan 2011 00:06:28 +0100 |
thanks Tamas,
I am trying to adapt your code to my case but I get this error:
import igraph
class Model:
# init bipartite network
def __init__(self, users, projects, directed):
self.g = igraph.Graph(users + projects, directed = directed)
self.g.vs["type"] = 0
self.g.vs[users:]["type"] = 1
File "/Users/ogabbrie/Desktop/PANMIND/models/ABMsimulator/Model.py", line 7, in
__init__
self.vs["type"] = 0
TypeError: object of type 'int' has no len()
what I am trying to accomplish is to build a graph object after setting some
parameters. Should I build my Model class as an extension of the Graph class?
> Note that igraph won't stop you from adding edges between vertices of the
> same type; the only reason why some igraph methods "think" that this graph is
> bipartite is because of the "type" attribute.
Thanks for the remainder!
best,
simone