Skip to content

emvolz/rclustnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rclustnet

Generate a random graph with desired size, clustering coefficient, and degree distribution

This uses a fast network growth algorithm. It is not an exact algorithm, so the resulting clustering coefficient may differ slightly from the requested value. Users may provide their own R functions to sample from the degree distribution.

  • Citation: Volz, EM, Physical Review E, 2004

examples

Let's generate a random graph with a Poisson degree distribution

library(rclustnet)
g <- rclustnet( n=50, CC = .25, rdegdist='pois', lambda = 3 )
plot.igraph( g ,vertex.size=1 , vertex.label=NA)

plot of chunk unnamed-chunk-1

Let's increase the clustering:

g <- rclustnet( n=50, CC = .50, rdegdist='pois', lambda = 3 )
plot.igraph( g ,vertex.size=1 , vertex.label=NA)

plot of chunk unnamed-chunk-2

Let's make one with a skewed degree distribution:

g <- rclustnet( n=100, CC = .15, rdegdist='geom',prob=.25 )
plot.igraph( g ,vertex.size=1 , vertex.label=NA)

plot of chunk unnamed-chunk-3

Let's make a big one:

g <- rclustnet( n=5e3, CC = .3, rdegdist='nbinom', size = 20, prob=.9 )
plot.igraph( g ,vertex.size=0, vertex.label=NA)

plot of chunk unnamed-chunk-4

Note that this took less than thirty seconds to generate.

About

Generate a random graph with desired size, clustering coefficient, and degree distribution

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages