GraphTheory[RandomGraphs][RandomRegularGraph] - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : RandomGraphs : GraphTheory/RandomGraphs/RandomRegularGraph

GraphTheory[RandomGraphs][RandomRegularGraph]

Calling Sequence

RandomRegularGraph(n,d)

RandomRegularGraph(n,d,connected)

Parameters

n

-

positive integer or list of vertices

d

-

nonnegative integer

connected

-

(literal) flag to indicate that the generated graph should be connected.

Description

• 

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.

Examples

withGraphTheory&colon;

withRandomGraphs&colon;

R:=RandomRegularGraph100&comma;80&comma;connected

R:=Graph 1: an undirected unweighted graph with 100 vertices and 4000 edge(s)

(1)

IsRegularR

true

(2)

IsConnectedR

true

(3)

R:=RandomRegularGraphseqa..j&comma;3&comma;weights&equals;10..10

R:=Graph 2: an undirected weighted graph with 10 vertices and 15 edge(s)

(4)

WeightMatrixR

00000910010047000010004000660000700400020000400080190600000010106000060000008060500100200050010001100000

(5)

f:=RandomTools:-Generatefloatrange&equals;0.1..1&comma;digits&equals;2&comma;makeproc&equals;true&colon;

R:=RandomRegularGraph10&comma;3&comma;weights&equals;f

R:=Graph 3: an undirected weighted graph with 10 vertices and 15 edge(s)

(6)

WeightMatrixR

0000.650.720000.27000000000.530.160.400000.26000.3800.2100.6500.26000.3100000.7200000.1200.66000000.310.1200000.64000.3800000.7601.000.53000.6600.760000.270.160.21000000000.400000.641.0000

(7)

U:=rand1..4&colon;

f := proc() local x; x := U(); if x=1 then 1 else 2 fi end:

H:=RandomRegularGraph10&comma;3&comma;connected&comma;weights&equals;f

H:=Graph 4: an undirected weighted graph with 10 vertices and 15 edge(s)

(8)

WeightMatrixH

0201020000200020100000000002121000020010020000100220020001000100100100002001100000110000010020200010

(9)

See Also

AssignEdgeWeights, GraphTheory[IsConnected], GraphTheory[WeightMatrix], RandomBipartiteGraph, RandomDigraph, RandomGraph, RandomNetwork, RandomTournament, RandomTree


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam