Grid Graph Layout Method - Maple Help

Grid Graph Layout Method

Options

 • center=list(numeric)
 a point for the center of the grid. The origin is the default.
 • order=list({1,2,3})
 the order in which to fill the grid, given in reverse priority.  The default is $\left[1,2,3\right]$ which fills the 3rd (z) axis first, then the 2nd (y) axis, then finally the x-axis. For two dimensions, the third value is ignored so the valid options are $\left[1,2\right]$ (sweep up columns) and $\left[2,1\right]$ (sweep across rows).
 • width=numeric
 the width of the grid; 1.95 is the default.

Description

 • The grid layout method evenly spaces the vertices of the graph along a grid in order starting in the corner in the negative direction, and filling in the positive direction on each axis in turn.
 • This layout method works in two or three dimensions and is best suited to very sparse graphs.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\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{grid}\right)$
 > $H≔\mathrm{RandomGraphs}:-\mathrm{RandomGraph}\left(20,40\right)$
 ${H}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 20 vertices and 40 edge\left(s\right)}}$ (2)
 > $\mathrm{DrawGraph}\left(H,\mathrm{dimension}=3,\mathrm{layout}=\mathrm{grid}\right)$