## Example using an igraph object as input data
set.seed(1)
G <- igraph::sample_gnp(n=30, p=0.5)
# Using strings to indicate the graph models
result1 <- graph.model.selection(G, models=c('ER', 'WS'), eps = 0.5)
result1
# \donttest{
## Using functions to describe the graph models
# Erdos-Renyi graph
model1 <- function(n, p) {
return(igraph::sample_gnp(n, p))
}
# Watts-Strogatz small-world graph
model2 <- function(n, pr, K=8) {
return(igraph::sample_smallworld(1, n, K, pr))
}
parameters <- list(seq(0.01, 0.99, 0.49), seq(0.01, 0.99, 0.49))
result2 <- graph.model.selection(G, list(model1, model2), parameters)
result2
# }
Run the code above in your browser using DataLab