Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(igraph)
- ERG <- function(n, p, type = c("gnp"), directed = FALSE, loops = FALSE)
- {
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- res <- .Call("R_igraph_erdos_renyi_game", as.numeric(n),
- as.numeric(p), as.logical(directed),
- as.logical(loops), PACKAGE = "igraph")
- if (igraph_opt("add.params")) {
- res$name <- sprintf("Eros renyi (%s) graph", type)
- res$type <- type
- res$loops <- loops
- if (type == "gnp") {
- res$p <- p
- }
- if (type == "gnm") {
- res$m <- p
- }
- }
- res
- }
- plot(ERG(12,.15), vertex.color=2, main="First random graph")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement