GraphTheory[RandomGraphs] - Maple Programming Help

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

GraphTheory[RandomGraphs]

 RandomBipartiteGraph

 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 - real number between 0.0 and 1.0 m - non-negative integer options - sequence of options (see below)

Description

 • RandomBipartiteGraph(n, p) creates an undirected unweighted bipartite graph on n vertices where each possible edge is present with probability p.
 • RandomBipartiteGraph(n, m) creates an undirected unweighted bipartite graph on n vertices and m edges where the m edges are chosen uniformly at random.
 • RandomBipartiteGraph([a,b], p) creates an undirected 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 undirected unweighted bipartite graph on a+b vertices with partite sets of sizes a and b, and with m edges chosen uniformly at random.
 • If the option weights=m..n is specified, where m <= n 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 x <= y 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.
 • The random number generator used can be seeded using the randomize function.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{with}\left(\mathrm{RandomGraphs}\right):$
 > $G≔\mathrm{RandomBipartiteGraph}\left(10,0.5\right)$
 ${G}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 10 vertices and 11 edge\left(s\right)}}$ (1)
 > $\mathrm{IsBipartite}\left(G,'p'\right)$
 ${\mathrm{true}}$ (2)
 > $p$
 $\left[\left[{1}{,}{2}{,}{3}{,}{4}{,}{5}{,}{6}{,}{7}\right]{,}\left[{8}{,}{9}{,}{10}\right]\right]$ (3)
 > $G≔\mathrm{RandomBipartiteGraph}\left(\left[2,3\right],1.0\right)$
 ${G}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 5 vertices and 6 edge\left(s\right)}}$ (4)
 > $\mathrm{Neighbors}\left(G\right)$
 $\left[\left[{3}{,}{4}{,}{5}\right]{,}\left[{3}{,}{4}{,}{5}\right]{,}\left[{1}{,}{2}\right]{,}\left[{1}{,}{2}\right]{,}\left[{1}{,}{2}\right]\right]$ (5)
 > $G≔\mathrm{RandomBipartiteGraph}\left(\left[2,2\right],4,\mathrm{weights}=1..10\right)$
 ${G}{≔}{\mathrm{Graph 3: an undirected weighted graph with 4 vertices and 4 edge\left(s\right)}}$ (6)
 > $\mathrm{WeightMatrix}\left(G\right)$
 $\left[\begin{array}{rrrr}{0}& {0}& {9}& {7}\\ {0}& {0}& {1}& {10}\\ {9}& {1}& {0}& {0}\\ {7}& {10}& {0}& {0}\end{array}\right]$ (7)
 > $H≔\mathrm{RandomBipartiteGraph}\left(\left[7,11\right],45\right)$
 ${H}{≔}{\mathrm{Graph 4: an undirected unweighted graph with 18 vertices and 45 edge\left(s\right)}}$ (8)
 > $\mathrm{ChromaticIndex}\left(H\right)$
 ${9}$ (9)