randomNodeGraph {graph} | R Documentation |
randomNodeGraph
generates a random graph with the specified
degree distribution. Self-loops are allowed. The resultant graph is
directed (but can always be coerced to be undirected).
randomNodeGraph(nodeDegree)
nodeDegree |
A named integer vector specifying the node degrees. |
The input vector must be named, the names are taken to be the names of the nodes. The sum must be even (there is a theorem that says we require that to construct a graph). Self-loops are allowed, although patches to the code that make this a switchable parameter would be welcome.
An instance of the graphNEL
class. The graph is directed.
R. Gentleman
Random Graphs as Models of Networks, M. E. J. Newman.
set.seed(123) c1 <- c(1,1,2,4) names(c1) <- letters[1:4] g1 <- randomNodeGraph(c1)