Welcome to RandomGraphs.jl’s documentation!

RandomGraphs.jl is a Julia package that provides generators for random graphs. It relies on the Graphs.jl package.

Contents

Erdős–Rényi graphs

The Erdős–Rényi model sets an edge between each pair of vertices with equal probability, independently of the other edges.

erdos_renyi_graph(g, n, p[; has_self_loops=false])

Add edges between vertices 1:n of graph g randomly, adding each possible edge with probability p independently of all others.

Parameters:
  • g – the input graph
  • n – the number of vertices between which to add edges
  • p – the probability with which to add each edge
  • has_self_loops – whether to consider edges v -> v.
Returns:

the graph g.

erdos_renyi_graph(n, p[, has_self_loops=false])

Convenience function to construct an n-vertex Erdős–Rényi graph as an incidence list.

Watts-Strogatz graphs

The Watts–Strogatz model is a random graph generation model that produces graphs with small-world properties, including short average path lengths and high clustering.

watts_strogatz_graph(g, n, k, beta)

Adjust the edges between vertices 1:n of the graph g in accordance with the Watts-Strogatz model.

Parameters:
  • g – the input graph
  • n – the number of vertices between which to adjust edges
  • k – the base degree of each vertex (n > k, k >= 2, k must be even.)
  • beta – the probability of each edge being “rewired”.
Returns:

the graph g.

watts_strogatz_graph(n, k, beta)

Convenience function to construct an n-vertex Watts-Strogatz graph as an incidence list.

Niche model graphs

The Niche model is used to generate realistic random graphs resembling predator-prey networks, or food webs. Its inputs are a number of species, and expected connectance (density)

niche_model_graphs(g, S, C)

Generates one random model with S species

Parameters:
  • S – number of species (vertices)
  • C – expected connectance (density), between 0 (no arcs) and 1 (complete graph)
Returns:

the directed graph g

niche_model_graph(S, C)

Convenience function to generate a graph using the niche model

Indices and tables