The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Graph::Maker::GosperIsland - create GosperIsland grid graphs

SYNOPSIS

 use Graph::Maker::GosperIsland;
 $graph = Graph::Maker->new ('Gosper_island');

DESCRIPTION

Graph::Maker::GosperIsland creates a Graph.pm graph of the Gosper island hexagonal grid,

                                   *---*
        *---*                     /     \
       /     \               *---*       *---*     level => 1
      *       *             /     \     /     \
       \     /             *       *---*       *
        *---*               \     /     \     /
                             *---*       *---*
      level => 0            /     \     /     \
                           *       *---*       *
                            \     /     \     /
                             *---*       *---*
                                  \     /
                                   *---*

level => $k is the grid expansion level. Each level is 7 copies of the previous, arranged with common sides in the surround pattern of level 1. The effect is slowly curling spiralling boundaries (the shape of the terdragon curve unfolded to 120 degrees).

                    * *
           * *   * *   * *
        * *   * *   * *   *          level => 2
       *   * *   * *   * *
        * *   * *   * *   * *
       *   * *   * *   * *   * *
        * *   * *   * *   * *   *
     * *   * *   * *   * *   * *
    *   * *   * *   * *   * *   *
     * *   * *   * *   * *   * *
    *   * *   * *   * *   * *
     * *   * *   * *   * *   *
        * *   * *   * *   * *
           * *   * *   * *   *
          *   * *   * *   * *
           * *   * *   * *
              * *

level=1 is a 6-cycle like Graph::Maker::Cycle.

level=2 is a 2x2x2 hex grid like Graph::Maker::HexGrid can give.

The graph size grows rapidly with the level,

    num hexagons = 7^k
                 = 1, 7, 49, 343, 2401, ...    (A000420)
    num vertices = 2*7^k + 3^(k+1) + 1
                 = 6, 24, 126, 768, 5046, ...
    num edges    = 3*7^k + 3^(k+1)
                 = 6, 30, 174, 1110, 7446, ...

These formulas follow from a bottom-up construction. Each existing edge becomes 3 edges and inside each hexagon is a new hexagon and edges to the outside there to make the level 1 base figure.

Vertex names are currently x,y coordinates used in the construction, but don't rely on that.

FUNCTIONS

$graph = Graph::Maker->new('Gosper_island', key => value, ...)

The key/value parameters are

    level       => integer>=0, island expansion
    graph_maker => subr(key=>value) constructor, default Graph->new

Other parameters are passed to the constructor, either graph_maker or Graph->new().

If the graph is directed (the default) then edges are added both ways between vertices (like Graph::Maker::Grid does). Option undirected => 1 creates an undirected graph and for it there is a single edge between vertices.

HOUSE OF GRAPHS

House of Graphs entries for graphs here include

level=0 https://hog.grinvin.org/ViewGraphInfo.action?id=670, 6-cycle
level=1 https://hog.grinvin.org/ViewGraphInfo.action?id=28529, hex grid 2,2,2
level=2 https://hog.grinvin.org/ViewGraphInfo.action?id=28531

SEE ALSO

Graph::Maker, Graph::Maker::Cycle, Graph::Maker::Grid, Graph::Maker::HexGrid

HOME PAGE

http://user42.tuxfamily.org/graph-maker-other/index.html

LICENSE

Copyright 2017, 2018, 2019, 2020, 2021 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/.