igraph-help
[Top][All Lists]

## Re: [igraph] assortativity for small world graph

 From: simone gabbriellini Subject: Re: [igraph] assortativity for small world graph Date: Tue, 25 Aug 2009 17:05:14 +0200

ohh I was misunderstanding the nei option... I get your point, so I think I can use this instead:
```
gSW= Graph.Watts_Strogatz(dim=1,size=g.vcount(), nei=1,p=0.05)

```
but can I specify the mean size of the neighborhood? it looks like it is fixed on 2, is it?
```
thanks a lot,
Simone

Il giorno 25/ago/09, alle ore 16:54, Tamas Nepusz ha scritto:

```
```Hi Simone,

```
```gSW = Graph.Lattice([1,g.vcount()], nei=sum(g.degree())/g.vcount(),
directed=True, mutual=False);
```
```Note that the nei=... option is not supported yet in the Python
interface, so this is equivalent to a ring with g.vcount() vertices.
```
Also note that the Python code snippet you use uses the total degree, so
```there's no need to make your graph directed as the assortativity
calculation will treat it as if it were undirected.

```
```It seems that den1 and num2 are equal...
```
```It can happen easily if all the vertices have degree 1. In that case,
you end up with 0/0 in the definition of assortativity. Feel free to
```
catch the exception and treat the assortativity as zero in these cases.
```
--
Tamas

_______________________________________________
igraph-help mailing list
```