set.seed(42)
### Example giving only the name of the model to use
G <- igraph::sample_smallworld(dim = 1, size = 15, nei = 2, p = 0.2)
# Obtain the parameter of the WS model
estimated.parameter1 <- fast.graph.param.estimator(G, "WS", lo = 0.1, hi = 0.5,
eps = 1e-1, npoints = 10,
numCores = 1)
estimated.parameter1
if (FALSE) {
### Example giving a function instead of a model
# Defining the model to use
G <- igraph::sample_smallworld(dim = 1, size = 5000, nei = 2, p = 0.2)
K <- as.integer(igraph::ecount(G)/igraph::vcount(G))
fun_WS <- function(n, param, nei = K){
return (igraph::sample_smallworld(dim = 1,size = n, nei = nei, p = param))
}
# Obtain the parameter of the WS model
estimated.parameter2 <- fast.graph.param.estimator(G, fun_WS, lo = 0.0, hi = 1.0,
npoints = 100, numCores = 2)
estimated.parameter2
}
Run the code above in your browser using DataLab