Learn R Programming

epinet (version 0.0-7)

buildER: Build an Erdos-Renyi graph object

Description

Builds an undirected Bernoulli (Erdos-Renyi) graph object and returns the result in the form of an edgelist matrix.

Usage

buildER(N, p)

Arguments

N
number of nodes in the graph.
p
probability of presence of an edge between two nodes.

Value

  • A 2 column matrix contains a list of all edges in the generated graph.

Details

Creates a random graph with N nodes. Generates edges according to a Bernoulli random variable. Each potential edge will exist with probability p. Uses an algorithm from Batagelj and Brandes (2005). Partially based on C code from Butts (2008)

References

  • Batagelj, V. and Brandes, U. 2005. Efficient Generation of Large random Networks,Physical Review E,71-3
Butts, C. 2008. network: A Package for Managing Relational Data in R, Journal of Statistical Software, 24-2 Erdos, P. and Renyi, A. 1959. On random graphs, Publicationes Mathematicae, 6, 290-297.

Examples

Run this code
# Create a Bernoulli network with 100 nodes

net <- buildER(100,0.01)

Run the code above in your browser using DataLab