positive integer or list of vertices
(literal) flag to indicate that the generated graph should be connected.
RandomRegularGraph(n,d) creates a d-regular undirected unweighted graph on n vertices. n and d cannot both be odd and d must satisfy d < n.
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 n > 2 and d > 1 as well as the above.
For RandomRegularGraph(n,d,connected), a random tree with maximum degree <= d 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 randomize function.
R ≔ RandomRegularGraph⁡100,80,connected
R ≔ Graph 1: an undirected unweighted graph with 100 vertices and 4000 edge(s)
R ≔ RandomRegularGraph⁡seq⁡a..j,3,weights=−10..10
R ≔ Graph 2: an undirected weighted graph with 10 vertices and 15 edge(s)
f ≔ RandomTools:-Generate⁡float⁡range=0.1..1,digits=2,makeproc=true:
R ≔ RandomRegularGraph⁡10,3,weights=f
R ≔ Graph 3: an undirected weighted graph with 10 vertices and 15 edge(s)
U ≔ rand⁡1..4:
f := proc() local x; x := U(); if x=1 then 1 else 2 fi end:
H ≔ RandomRegularGraph⁡10,3,connected,weights=f
H ≔ Graph 4: an undirected weighted graph with 10 vertices and 15 edge(s)
Download Help Document
What kind of issue would you like to report? (Optional)
Thank you for submitting feedback on this help document. Your feedback will be used
to improve Maple's help in the future.