igraph-help
[Top][All Lists]

## Re: [igraph] question on scale free networks

 From: Gabor Csardi Subject: Re: [igraph] question on scale free networks Date: Tue, 6 Feb 2007 10:29:02 +0100 User-agent: Mutt/1.5.12-2006-07-14

```Vincent,

On Sun, Feb 04, 2007 at 01:42:15AM -0500, Vincent Matossian wrote:
>
>   Hi,
>
> I am trying to get a graph that has power-law probability distribution P(k) :=
> k^ (-alpha)
>
> I realize that in ba.game the above alpha is not the same as the 'power'
> parameter which controls the preferential attachment (I noticed that a power
> of
> 1 gives an alpha of ~2). Am I missing a mechanism that would give me a graph
> that has a final degree distribution as above by controlling alpha, for
> example
> a logarithmic slope of - 2.5, -2.1 or -3 ?

see ?barabasi.game, power=1 gives linear preferential attachment, and

Different powers give different results, not always a power-law
distribution, so sometimes is doesn't make sense to calculate the
alpha exponent, see http://arxiv.org/abs/cond-mat/0005139.

Btw. for fitting power-law distributions it is usually not a good idea
to fit a straight line on a log-log plot, as this method has a bias
and gives you the wrong exponent. You should use maximum likelihood
fitting, see http://arxiv.org/abs/cond-mat/0412004 for the theory and
?power.law.fit in igraph for the practice.

Example:

> data <- sample( 1:10000, 100000, replace=T, prob=(1:10000)^-2.4)
> power.law.fit(data)

Call:
mle(minuslogl = mlogl, start = list(alpha = start))

Coefficients:
alpha
2.403472

> g <- barabasi.game(100000)
> d <- degree(g)
> power.law.fit(d)

Call:
mle(minuslogl = mlogl, start = list(alpha = start))

Coefficients:
alpha
2.298806
>
> power.law.fit(d, xmin=10)

Call:
mle(minuslogl = mlogl, start = list(alpha = start))

Coefficients:
alpha
2.877295
Warning message:
too small values eliminated from vector in: power.law.fit(d, xmin =
10)
>

The last example also shows that the alpha=-3 power-law is valid only
for the higher degrees.

As for a mechanism to generate networks with different exponents,
you might check http://arxiv.org/abs/cond-mat/0106096, a number of
mechanisms are explained here, although i don't think they're in
igraph. igraph has aging, check http://arxiv.org/abs/cond-mat/0001419
and ?aging.prefatt.game.

Cheers,
Gabor

>
> Thanks,
>
> Vincent
>
> PS
> For example:
>
> plotsf=function(ba,offset=0.0){
>   d=seq(0,max(degree(ba)))
>   n=vcount(ba)*degree.distribution(ba)
>
>   ld=log(d+offset,base=10)
>   ln=log(n+offset,base=10)
>
>   plot(ld,ln)
>   lfit<-lm(ln~ld)
>   abline(coef=coef(lfit))
>   print(coef(lfit))
> }
>
> ba=ba.game(10000,power=1)
> plotsf(ba,-.5) # -.5 for adjustment for Inf values in computing log
> # this returns a slope of -2
> ba2=ba.game(10000,power=2)
> plotsf(ba2,-.5)
> # returns a slope of -0.6 but what control know would  get me a slope of -2.5
> or  -3, ...?
>
>

> _______________________________________________
> igraph-help mailing list