[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: |
Tamás Nepusz |
Subject: |
Re: [igraph] how to build a bipartite graph with python |
Date: |
Tue, 18 Jan 2011 00:16:25 +0100 |
> 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()
My bad; igraph 0.5.* does not support this yet, igraph 0.6 will. Use this:
self.vs["type"] = [int(i >= n1) for i in xrange(n1+n2)]
> 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?
Composition is usually better than inheritance in such cases; i.e. make your
model class *contain* a graph instance instead of making your model inherit
from Graph.
--
Tamas