Graph::Maker::RookGrid - create Rook grid graph
use Graph::Maker::RookGrid; $graph = Graph::Maker->new ('rook_grid', dims => [8,8]);
Graph::Maker::RookGrid creates a Graph.pm graph for a grid of squares with edges connecting squares as a chess rook moves.
Graph::Maker::RookGrid
Graph.pm
This means at a given vertex move anywhere in the same row or column. For higher dimensions it means any change in a single coordinate.
The dims parameter is the same as Graph::Maker::Grid but the edges here include steps bigger than 1.
dims
Graph::Maker::Grid
+------+------+------+------+ dims => [3,4] | | | | | | 1 | 2 | 3 | 4 | edges 1 to 2,3,4,5,9 | | | | | 2 to 1,6,10,3,4 +------+------+------+------+ ... | | | | | 7 to 5,6,8,3,11 | 5 | 6 | 7 | 8 | ... | | | | | etc +------+------+------+------+ | | | | | | 9 | 10 | 11 | 12 | | | | | | +------+------+------+------+
1xN grids are complete-N graphs the same as Graph::Maker::Complete.
2x2x...x2 grids are hypercubes the same as Graph::Maker::Hypercube.
There is no cyclic parameter since the edges are already effectively cyclic, having for example an edge 4 to 1, and 4 to anywhere else in the row, etc.
cyclic
$graph = Graph::Maker->new('rook_grid', key => value, ...)
The key/value parameters are
dims => arrayref of dimensions graph_maker => subr(key=>value) constructor, default Graph->new
dims is in the style of Graph::Maker::Grid. Other parameters are passed to the constructor, either graph_maker or Graph->new().
graph_maker
Graph->new()
Like Graph::Maker::Grid, if the graph is directed (the default) then edges are added both forward and backward between vertices. Option undirected => 1 creates an undirected graph and for it there is a single edge between vertices.
undirected => 1
House of Graphs entries for graphs here include
A few of the entries in Sloane's Online Encyclopedia of Integer Sequences related to these graphs include
http://oeis.org/A088699 (etc)
A088699 NxN number of independent sets A287274 NxM number of dominating sets A287065 NxN number of dominating sets A290632 NxM number of minimal dominating sets A289196 NxN number of connected dominating sets A286189 NxN number of connected induced subgraphs
Graph::Maker, Graph::Maker::Grid, Graph::Maker::Complete, Graph::Maker::Hypercube
Copyright 2015, 2016, 2017 Kevin Ryde
This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with This file. If not, see http://www.gnu.org/licenses/.
To install Graph::Maker::Other, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graph::Maker::Other
CPAN shell
perl -MCPAN -e shell install Graph::Maker::Other
For more information on module installation, please visit the detailed CPAN module installation guide.