Random Graph Layout Method - Maple Help

Random Graph Layout Method

Options

 • distribution=function
 This option can take any value understood by the RandomTools distribution generator. See RandomTools/flavor/distribution. This method will generate $n+{n}^{\frac{1}{d}}$ points and check if there were $n$ unique points generated.  If not, it will try again. If both distribution and generator options are given, only generator will be used.
 • generator=function
 This option can take a custom procedure that generates points (as lists) of the appropriate dimension. This method will generate $n+{n}^{\frac{1}{d}}$ points and check if there were $n$ unique points generated.  If not, it will try again. If both distribution and generator options are given, only generator will be used.
 • seed=posint
 Specify a seed to send to randomize before generating the random points.

Description

 • The random layout method uses RandomTools:-Generate to generate random positions for the vertices of the graph. By default, this method randomly populates a ${\left[2{n}^{\frac{1}{d}}\right]}^{d}$ grid with the graph vertices (with an additional small random perturbation added to reduce the likelihood of overlapping edges).
 • This layout method works in two and three dimensions.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{with}\left(\mathrm{SpecialGraphs}\right):$
 > $G≔\mathrm{Graph}\left(\mathrm{undirected},\left\{\left\{1,2\right\},\left\{1,4\right\},\left\{2,3\right\},\left\{3,4\right\}\right\}\right)$
 ${G}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 4 vertices and 4 edge\left(s\right)}}$ (1)
 > $\mathrm{DrawGraph}\left(G,\mathrm{layout}=\mathrm{random}\right)$
 > $\mathrm{DrawGraph}\left(G,\mathrm{layout}=\mathrm{random},\mathrm{layoutoptions}=\left[\mathrm{distribution}=\mathrm{Normal}\left(0,0.5\right)\right]\right)$

A custom procedure to create random points can also be used

 > $R≔\mathrm{RandomTools}:-\mathrm{Generate}\left(\mathrm{list}\left(\mathrm{distribution}\left(\mathrm{Uniform}\left(-0.97,0.97\right)\right),2\right),\mathrm{makeproc}\right):$
 > $\mathrm{DrawGraph}\left(G,\mathrm{layout}=\mathrm{random},\mathrm{layoutoptions}=\left[\mathrm{generator}=R\right]\right)$
 > $H≔\mathrm{HypercubeGraph}\left(3\right)$
 ${H}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 8 vertices and 12 edge\left(s\right)}}$ (2)
 > $\mathrm{DrawGraph}\left(H,\mathrm{layout}=\mathrm{random},\mathrm{dimension}=3\right)$