igraph-help
[Top][All Lists]

## Re: [igraph] Modularity function on python version

 From: Tamas Nepusz Subject: Re: [igraph] Modularity function on python version Date: Sun, 24 Feb 2008 13:39:03 +0100

```Dear Simone,

```
Which igraph version are you using? This definitely works for me with 0.5:
```
In [1]: g=igraph.Graph.Full(3)+igraph.Graph.Full(3)
In [2]: weights=[1,1,1,2,2,2]
In [3]: g.modularity([0,0,0,1,1,1], weights)
Out[3]: 0.44444444444444442
In [4]: print igraph.__version__
0.5

--
Tamas

On 2008.02.24., at 13:18, Simone Caschili wrote:

```
```Hello,

```
I'm using modularity function on igraph python version. I would get a value of modularity for my graph g that is a weighted graph while I would pass an a priori membership. Thus, in order to get what i need, i have built a list that represents my membership, it is like:
```
memb=[0,0,0,0,1,1,1,1,1]

```
I would just split my graph into two communities. Edge's weights are also stored in a list like:
```
weighs=[2,3,89,32,1,2,4]

When I run my code I get this error:

>Traceback (most recent call last):
> File "1.py", line 120, in ?
>    print g.modularity(memb,weights)
>TypeError: modularity() takes exactly 2 arguments (3 given)

```
Since I've tried to use only membership or weights, the code works but it doesn't solve my issue because i need a "weighed" modularity calculated on a certain membership.
```
Could anyone help me?
Thank you
_______________________________________________
igraph-help mailing list
```