igraph-help
[Top][All Lists]
Advanced

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

[igraph] Adding shortcuts to the Small Word model without rewiring the e


From: JOYCE
Subject: [igraph] Adding shortcuts to the Small Word model without rewiring the edges
Date: Sat, 15 Dec 2012 06:42:54 -0800 (PST)

Hello List,
I want to adjust the Watts-Strogatz model in R to  add shortcuts without removing (rewiring) the existing edge. Thus i want to preserve the initial small world model and add shortcuts with a specified probability,  without self-loops and multiple edges. I have attached a copy of what i want to get.
Using the code below i get what is expected alright but it doesn't satisfy the various properties. Eg.  it doesn't satisfy,  the expected number of shortcuts added being  ~ N*k*p  for N vertices and k neighbours.
I would be very grateful if any one has an R code function that gives the second type of watts model (thus just adding shortcuts and still preserve the initial structure). Thanks for your help.


#I started with the initial model at p=0
library(igraph)
wsk2 <- watts.strogatz.game(1, 100, 1, p=0)

#Create a binomial matrix of 0's and 1's  with a specified probability and then convert to graph
bmat2<-matrix(rbinom(100,1,0.1),100,100)                ##Source of the problem
bgh2<-graph.adjacency(bmat2, mode="undirected")  

#Add the binomial graph to initial graphs 
newg2<-simplify(graph.union(wsk2, bgh2))

       

Attachment: SmallWord.PNG
Description: PNG image


reply via email to

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