RandomBipartiteGraph - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


GraphTheory[RandomGraphs]

  

RandomBipartiteGraph

  

generate a random bipartite graph

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

RandomBipartiteGraph(n,p,options)

RandomBipartiteGraph(n,m,options)

RandomBipartiteGraph([a,b],p,options)

RandomBipartiteGraph([a,b],m,options)

Parameters

n, a, b

-

positive integers

p

-

numeric value between 0.0 and 1.0

m

-

non-negative integer

options

-

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

Options

• 

directed = truefalse

  

Specifies whether the graph should be directed. The default is false.

• 

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 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.

Description

• 

RandomBipartiteGraph(n, p) creates an unweighted bipartite graph on n vertices where each possible edge is present with probability p.

• 

RandomBipartiteGraph(n, m) creates an unweighted bipartite graph on n vertices and m edges where the m edges are chosen uniformly at random.

• 

RandomBipartiteGraph([a,b], p) creates an unweighted bipartite graph on a+b vertices with partite sets of sizes a and b, where each possible edge is present with probability p.

• 

RandomBipartiteGraph([a,b], m) creates an unweighted bipartite graph on a+b vertices with partite sets of sizes a and b, and with m edges chosen uniformly at random.

• 

By default, the created bipartite graph is undirected. If the option directed or directed=true is given, the resulting graph is directed.

• 

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

Examples

withGraphTheory:

withRandomGraphs:

GRandomBipartiteGraph10,0.5

GGraph 1: an undirected graph with 10 vertices and 8 edge(s)

(1)

IsBipartiteG,p

true

(2)

p

1,2,3,4,5,6,7,8,9,10

(3)

GRandomBipartiteGraph2,3,1.0

GGraph 2: an undirected graph with 5 vertices and 6 edge(s)

(4)

NeighborsG

3,4,5,3,4,5,1,2,1,2,1,2

(5)

GRandomBipartiteGraph2,2,4,weights=1..10

GGraph 3: an undirected weighted graph with 4 vertices and 4 edge(s)

(6)

WeightMatrixG

0067007967007900

(7)

HRandomBipartiteGraph7,11,45

HGraph 4: an undirected graph with 18 vertices and 46 edge(s)

(8)

ChromaticIndexH

8

(9)

Compatibility

• 

The GraphTheory[RandomGraphs][RandomBipartiteGraph] command was updated in Maple 2021.

• 

The directed option was introduced in Maple 2021.

• 

For more information on Maple 2021 changes, see Updates in Maple 2021.

See Also

AssignEdgeWeights

GraphTheory:-ChromaticIndex

GraphTheory:-IsBipartite

GraphTheory:-Neighbors

GraphTheory:-WeightMatrix

RandomDigraph

RandomGraph

RandomNetwork

RandomTournament

RandomTree