Skip to content

Instantly share code, notes, and snippets.

@Ddedalus
Last active May 7, 2018 17:13
Show Gist options
  • Save Ddedalus/cddf4a78d3938aae4aff11b0cbee94b7 to your computer and use it in GitHub Desktop.
Save Ddedalus/cddf4a78d3938aae4aff11b0cbee94b7 to your computer and use it in GitHub Desktop.
Random graph with given density
graphWithDensity <- function(no_vertices, dens){
erdos.renyi.game(no_vertices, as.integer(no_vertices * dens), type="gnm",
directed = T) # Create a graph with given number of vertices and edges
}
g3 <- graphWithDensity(15, 2)
plot(g3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment