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)
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)