++ed by:

1 non-PAUSE user.

Kevin Ryde
and 1 contributors

# 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