The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The package chessboard
implements different methods for
detecting neighbors. All are derived from the chess game and
allow user to define complex moves to create direct edges (links)
between nodes (sampling units). The following table provides a
description of the chess pieces available in
chessboard
.
Function | 2D network | Transect only | Quadrat only | Description |
---|---|---|---|---|
pawn() |
✅ | ❌ | ✅ | Finds neighbors vertically (i.e. along a transect) |
fool() |
✅ | ✅ | ❌ | Finds neighbors horizontally (i.e. along a quadrat) |
rook() |
✅ | ❌ | ❌ | Finds neighbors vertically and horizontally |
bishop() * |
✅ | ❌ | ❌ | Finds neighbors along the two diagonals |
knight() * |
✅ | ❌ | ❌ | Finds neighbors in ‘L’ shape |
queen() |
✅ | ❌ | ❌ | Finds neighbors horizontally, vertically, and diagonally |
wizard() |
✅ | ❌ | ❌ | Finds neighbors in all directions |
* These two chess pieces each have two variants:
bishop_left()
, bishop_right()
and
knight_left()
, knight_right()
.
In this vignette, we use an extended version (9 transects x 9
quadrats) of the network used in Casajus et al. (2023) to
illustrate methods for detecting neighbors implemented in
chessboard
and the impact of the different arguments.
The
pawn
can detect neighbors vertically, i.e. among quadrats along a transect.
The function pawn()
can be used to detect neighbors
(black dots in Fig. 1) of a specific node (red dot in Fig. 1).
User can change the default settings (Fig. 1A), by adding
directionality (directed = TRUE
, Fig. 1B) and reversing the
default directionality (directed = TRUE
and
reverse = TRUE
, Fig. 1C).
Figure 2 shows the connectivity matrix of the 9 x 9 network when
neighbors of all nodes are detected by the pawn
method and
with a degree of neighborhood of 4.
The
fool
can detect neighbors horizontally, i.e. among transects along a quadrat.
The function fool()
can be used to detect neighbors
(black dots in Fig. 3) of a specific node (red dot in Fig. 3).
User can change the default settings (Fig. 3A), by adding
directionality (directed = TRUE
, Fig. 3B) and reversing the
default directionality (directed = TRUE
and
reverse = TRUE
, Fig. 3C).
Figure 4 shows the connectivity matrix of the 9 x 9 network when
neighbors of all nodes are detected by the fool
method and
with a degree of neighborhood of 4.
The
rook
can detect neighbors both horizontally and vertically, i.e. among transects along a quadrat and among quadrats along a transect.
The function rook()
can be used to detect neighbors
(black dots in Fig. 5) of a specific node (red dot in Fig. 5).
User can change the default settings (Fig. 5A), by adding
directionality (directed = TRUE
, Fig. 5B) and reversing the
default directionality (directed = TRUE
and
reverse = TRUE
, Fig. 5C).
Figure 6 shows the connectivity matrix of the 9 x 9 network when
neighbors of all nodes are detected by the rook
method and
with a degree of neighborhood of 4.
The
bishop
can detect neighbors diagonally.
The function bishop()
can be used to detect neighbors
(black dots in Fig. 7) of a specific node (red dot in Fig. 7).
User can change the default settings (Fig. 7A), by adding
directionality (directed = TRUE
, Fig. 7B) and reversing the
default directionality (directed = TRUE
and
reverse = TRUE
, Fig. 7C).
Figure 8 shows the connectivity matrix of the 9 x 9 network when
neighbors of all nodes are detected by the bishop
method
and with a degree of neighborhood of 4.
The
knight
has a complex move, like an ‘L’ shape. It’s the difference between thewizard
and thequeen
.
The function knight()
can be used to detect neighbors
(black dots in Fig. 9) of a specific node (red dot in Fig. 9).
User can change the default settings (Fig. 9A), by adding
directionality (directed = TRUE
, Fig. 9B) and reversing the
default directionality (directed = TRUE
and
reverse = TRUE
, Fig. 9C).
Figure 10 shows the connectivity matrix of the 9 x 9 network when
neighbors of all nodes are detected by the knight
method
and with a degree of neighborhood of 4.
The
queen
can detect neighbors horizontally, vertically and diagonally. It’s a combination therook
and thebishop
.
The function queen()
can be used to detect neighbors
(black dots in Fig. 11) of a specific node (red dot in Fig. 11).
User can change the default settings (Fig. 11A), by adding
directionality (directed = TRUE
, Fig. 11B) and reversing
the default directionality (directed = TRUE
and
reverse = TRUE
, Fig. 11C).
Figure 12 shows the connectivity matrix of the 9 x 9 network when
neighbors of all nodes are detected by the queen
method and
with a degree of neighborhood of 4.
The
wizard
can detect neighbors in any direction. It’s a combination thequeen
and theknight
.
The function wizard()
can be used to detect neighbors
(black dots in Fig. 13) of a specific node (red dot in Fig. 13).
User can change the default settings (Fig. 13A), by adding
directionality (directed = TRUE
, Fig. 13B) and reversing
the default directionality (directed = TRUE
and
reverse = TRUE
, Fig. 13C).
Figure 14 shows the connectivity matrix of the 9 x 9 network when
neighbors of all nodes are detected by the wizard
method
and with a degree of neighborhood of 4.
It’s possible to create any kind of scenarios by combining the
previous moves and by changing the values of the arguments
degree
, directed
, and
reverse
.
Casajus N, Rievrs Borges E, Tabacchi E, Fried G & Mouquet N (2023) chessboard: An R package for creating network connections based on chess moves. R package version 0.1. URL: https://github.com/frbcesab/chessboard.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.