igraph (version 0.2.1)

degree.sequence.game: Generate random graphs with a given degree sequence

Description

It is often useful to create a graph with given vertex degrees. This is exactly what degree.sequence.game does.

Usage

degree.sequence.game(out.deg, in.deg = numeric(0), method = "simple", ...)

Arguments

out.deg
Numeric vector, the sequence of degrees (for undirected graphs) or out-degrees (for directed graphs). For undirected graphs its sum should be even. For directed graphs its sum should be the same as the sum of in.deg.
in.deg
For directed graph, the in-degree sequence.
method
Character, the method for generating the graph. Right now only simple is implemented.
...
Additional arguments, these are used as graph attributes.

Value

  • The new graph object.

Details

The simple method connects the out-stubs of the edges (undirected graphs) or the out-stubs and in-stubs (directed graphs) together. This way loop edges and also multiple edges may be generated.

See Also

erdos.renyi.game, barabasi.game, simplify to get rid of the multiple and/or loops edges.

Examples

Run this code
g <- degree.sequence.game(rep(2,100))
degree(g)
g2 <- degree.sequence.game(1:10, 10:1)
degree(g2, mode="out")
degree(g2, mode="in")

Run the code above in your browser using DataCamp Workspace