# require("Rgraphviz")
set.seed(37)
dag1 <- randDAG(10,4,"regular")
dag2 <- randDAG(10,4,"watts")
dag3 <- randDAG(10,4,"er")
dag4 <- randDAG(10,4,"power")
dag5 <- randDAG(10,4,"bipartite")
dag6 <- randDAG(10,4,"barabasi")
dag7 <- randDAG(10,4,"geometric")
dag8 <- randDAG(10,4,"interEr",par2=0.5)
par(mfrow=c(4,2))
plot(dag1,main="Regular graph")
plot(dag2,main="Watts-Strogatz graph")
plot(dag3,main="Erdoes-Renyi graph")
plot(dag4,main="Power-law graph")
plot(dag5,main="Bipartite graph")
plot(dag6,main="Barabasi graph")
plot(dag7,main="Geometric random graph")
plot(dag8,main="Interconnected island graph")
set.seed(45)
dag0 <- randDAG(6,3)
dag1 <- randDAG(6,3,weighted=FALSE)
dag2 <- randDAG(6,3,DAG=FALSE)
par(mfrow=c(1,2))
plot(dag1)
plot(dag2) ## undirected graph
dag0@edgeData ## note the uniform weights between 0.1 and 1
dag1@edgeData ## note the constant weights
wFUN <- function(m,lB,uB) { runif(m,lB,uB) }
dag <- randDAG(6,3,wFUN=list(wFUN,1,4))
dag@edgeData ## note the uniform weights between 1 and 4
Run the code above in your browser using DataLab