igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Adding shortcuts to the Small Word model without rewiring t


From: Tamás Nepusz
Subject: Re: [igraph] Adding shortcuts to the Small Word model without rewiring the edges
Date: Wed, 19 Dec 2012 16:48:55 +0100

> bmat2<-matrix(rbinom(100,1,0.1),100,100)                ##Source of the 
> problem
You probably need matrix(rbinom(100*100, 1, 0.1), 100, 100), otherwise all the 
columns in the matrix will be equal (because the elements generated by rbinom 
are enough only for the first column). Also, note that you only have to 
populate the upper triangle of the matrix because your graph is undirected. So 
the correct solution would be:

bmat2 <- matrix(0, 100, 100)
bmat2[upper.tri(bmat2)] <- rbinom(99*50, 1, 0.1)

-- 
T.


reply via email to

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