Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rgnm

Draw Density-Conditioned Random Graphs


Description

rgnm generates random draws from a density-conditioned uniform random graph distribution.

Usage

rgnm(n, nv, m, mode = "digraph", diag = FALSE, 
    return.as.edgelist = FALSE)

Arguments

n

the number of graphs to generate.

nv

the size of the vertex set (|V(G)|) for the random graphs.

m

the number of edges on which to condition.

mode

"digraph" for directed graphs, or "graph" for undirected graphs.

diag

logical; should loops be allowed?

return.as.edgelist

logical; should the resulting graphs be returned in edgelist form?

Details

rgnm returns draws from the density-conditioned uniform random graph first popularized by the famous work of Erdos and Renyi (the G(N,M) process). In particular, the pmf of a G(N,M) process is given by

p(G=g|N,M) = 1/Choose(E_m,M)

where E_m is the maximum number of edges in the graph. (E_m is equal to nv*(nv-diag)/(1+(mode=="graph")).)

The G(N,M) process is one of several process which are used as baseline models of social structure. Other well-known baseline models include the Bernoulli graph (the G(N,p) model of Erdos and Renyi) and the U|MAN model of dyadic independence. These are implemented within sna as rgraph and rgnm, respectively.

Value

A matrix or array containing the drawn adjacency matrices

Note

The famous mathematicians referenced in this man page now have misspelled names, due to R's difficulty with accent marks.

Author(s)

Carter T. Butts buttsc@uci.edu

References

Erdos, P. and Renyi, A. (1960). “On the Evolution of Random Graphs.” Public Mathematical Institute of Hungary Academy of Sciences, 5:17-61.

See Also

Examples

#Draw 5 random graphs of order 10 
all(gden(rgnm(5,10,9,mode="graph"))==0.2) #Density 0.2
all(gden(rgnm(5,10,9))==0.1)              #Density 0.1

#Plot a random graph
gplot(rgnm(1,10,20))

sna

Tools for Social Network Analysis

v2.6
GPL (>= 2)
Authors
Carter T. Butts [aut, cre, cph]
Initial release
2020-10-5

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.