[Top][All Lists]

[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


I am using the following code to generate scale-free networks with different exponents, taken from (

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


reply via email to

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