GraphTheory[RandomGraphs]
RandomRegularGraph
generate a random regular graph
Calling Sequence
Parameters
Options
Description
Examples
RandomRegularGraph(n,d,options)
n
-
positive integer or list of vertices
d
nonnegative integer
options
(optional) equation(s) of the form option=value where option is one of connected or seed
connected = truefalse
If specified, indicates that the generated graph should be connected.
seed = integer or none
Seed for the random number generator. When an integer is specified, this is equivalent to calling randomize(seed).
RandomRegularGraph(n,d) creates a d-regular undirected unweighted graph on n vertices. n and d cannot both be odd and d must satisfy .
If the option connected is specified, the graph created will be connected. n and d must then satisfy n = 1 and d = 0, or n = 2 and d = 1, or and as well as the above.
For RandomRegularGraph(n,d,connected), a random tree with maximum is first created.
For generating weighted graphs use weights = f and see AssignEdgeWeights for details about f.
The random number generator used can be seeded using the seed option or the randomize function.
f := proc() local x; x := U(); if x=1 then 1 else 2 end if; end proc:
See Also
AssignEdgeWeights
GraphTheory:-IsConnected
GraphTheory:-WeightMatrix
RandomBipartiteGraph
RandomDigraph
RandomGraph
RandomNetwork
RandomTournament
RandomTree
Download Help Document