RandomTournament - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


GraphTheory[RandomGraphs]

  

RandomTournament

  

generate random tournament

 

Calling Sequence

Parameters

Options

Description

Examples

Calling Sequence

RandomTournament(V,options)

RandomTournament(n,options)

Parameters

V

-

list of vertex labels

n

-

positive integer

options

-

(optional) equation(s) of the form option=value where option is one of seed or weights

Options

• 

seed = integer or none

  

Seed for the random number generator. When an integer is specified, this is equivalent to calling randomize(seed).

• 

weights = range or procedure

  

If the option weights=m..n is specified, where mn are integers, the graph 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 xy are decimals is specified, the graph is a weighted graph with numerical edge weights chosen from [x,y] uniformly at random.  The weight matrix W in the graph ha 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.

Description

• 

RandomTournament(n) creates a random tournament on n vertices. This is a directed graph such that for every pair of vertices u and v either the arc u to v or the arc v to u is in the digraph.

• 

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.

• 

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

Examples

withGraphTheory:

withRandomGraphs:

TRandomTournament5

TGraph 1: a directed graph with 5 vertices and 10 arc(s)

(1)

TRandomTournament5,weights=1..5

TGraph 2: a directed weighted graph with 5 vertices and 10 arc(s)

(2)

IsTournamentT

true

(3)

WeightMatrixT

0305200000320500100001420

(4)

See Also

AssignEdgeWeights

GraphTheory:-IsTournament

GraphTheory:-WeightMatrix

RandomBipartiteGraph

RandomDigraph

RandomGraph

RandomNetwork

RandomTree

 


Download Help Document