igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Generating scale-free networks with different exponents


From: Narges Zarrabi
Subject: [igraph] Generating scale-free networks with different exponents
Date: Tue, 8 Nov 2011 16:44:57 +0100

Hi,

I am using the following code to generate scale-free networks with different exponents, taken from (http://127.0.0.1:20410/library/igraph/html/degree.sequence.game.html).

n<-1000
scale<-1.9
degs <- sample(1:n, n, replace=TRUE, prob=(1:n)^(-scale))
if (sum(degs) %% 2 != 0) { degs[1] <- degs[1] + 1 }
g <- degree.sequence.game(degs, method="vl")
all(degree(g) == degs)

The code works sometimes, but most of the times I receive the following error:

Error in degree.sequence.game(degs, method = "vl") : 
  At gengraph_mr-connected.cpp:139 : Cannot realize the given degree sequence as an undirected, simple graph, Invalid value

Also I don't understand what is the reason having the last line in the code: all(degree(g) == degs)

Any comments that can help? Many thanks

Narcis

reply via email to

[Prev in Thread] Current Thread [Next in Thread]