GraphTheory[RandomGraphs][RandomDigraph] - Maple Help

Online Help

All Products    Maple    MapleSim


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

GraphTheory[RandomGraphs][RandomDigraph]

Calling Sequence

RandomDigraph(n, p, options)

RandomDigraph(n, m, options)

Parameters

n

-

positive integer or list of vertices

p

-

numerical value in the closed range [0.0,1.0]

m

-

non-negative integer

options

-

sequence of options (see below)

Description

• 

RandomDigraph(n,m) creates a directed unweighted graph on n vertices and m edges, where the m edges are chosen uniformly at random.

• 

RandomDigraph(n,p) creates a directed unweighted graph on n vertices where each possible edge is present with probability p.

• 

If the first input is a positive integer n, then the vertices are labeled 1,2,...,n.  Alternatively you may specify the vertex labels in a list.

• 

If the option weights=m..n is specified, where m <= n are integers, the graph returned is a weighted graph with edge weights chosen from [m,n] uniformly at random.  The weight matrix W in the graph has datatype=integer, and if the edge from vertex i to j is not in the graph then W[i,j] = 0.

• 

If the option weights=x..y where x <= y are decimals is specified, the graph returned is a weighted graph with numerical edge weights chosen from [x,y] uniformly at random.  The weight matrix W in the graph has datatype=float[8], that is, double precision floats (16 decimal digits), and if the edge from vertex i to j is not in the graph then W[i,j] = 0.0.

• 

If the option weights=f where f is a function (a Maple procedure) that returns a number (integer, rational, or decimal number), then f is used to generate the edge weights.  The weight matrix W in the graph has datatype=anything, and if the edge from vertex i to j is not in the graph then W[i,j] = 0.

• 

The random number generator used can be seeded using the randomize function.

Examples

withGraphTheory&colon;

withRandomGraphs&colon;

G:=RandomDigraph10&comma;0.5

G:=Graph 1: a directed unweighted graph with 10 vertices and 42 arc(s)

(1)

IsDirectedG

true

(2)

H:=RandomDigraph10&comma;20

H:=Graph 2: a directed unweighted graph with 10 vertices and 20 arc(s)

(3)

J:=RandomDigraph4&comma;6&comma;weights&equals;1..4

J:=Graph 3: a directed weighted graph with 4 vertices and 6 arc(s)

(4)

WeightMatrixJ

0022004302000400

(5)

See Also

AssignEdgeWeights, GraphTheory[IsDirected], GraphTheory[WeightMatrix], RandomBipartiteGraph, 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