Get started

The aim of the package chessboard is to provide tools to work with directed (asymmetric) and undirected (symmetrical) spatial (or non-spatial) networks. It implements different methods to detect neighbors, all based on the chess game (it goes beyond the rook and the queen available in many R packages) to create complex connectivity scenarios.

chessboard aims to easily create various network objects, including:

# Setup ----

Network properties

chessboard can handle spatial networks, but it does not explicitly use geographical coordinates to find neighbors (it is not based on spatial distance). Instead, it identifies neighbors according to node labels (i.e. the node position on a two-dimension chessboard) and a specific method (pawn, fool, rook, bishop, knight, queen, wizard, etc.) derived from the chess game.

Figure 1. Network as a chessboard

Figure 1. Network as a chessboard

The package chessboard is designed to work with two-dimensional networks (i.e.  sampling on a regular grid), where one dimension is called transect and the other is called quadrat. By convention, the dimension transect corresponds to the x-axis, and the quadrat corresponds to the y-axis (Fig. 1).

chessboard can also deal with one-dimensional network (either transect-only or quadrat-only).

The network can be undirected or directed. If the network is directed, it will have (by default) these two orientations:

Neighbors detection

chessboard implements the following rules to detect neighbors and to create edges:


The Figure 2 shows the general workflow and the main features of chessboard.

Figure 2. Workflow and main features of `chessboard`

Figure 2. Workflow and main features of chessboard


The package chessboard comes with a real-world example: a survey sampling along the French river L’Adour (Fig. 3). L’Adour is a river in southwestern France. It rises in the Pyrenees and flows into the Atlantic Ocean (Bay of Biscay). It’s oriented from south-east (upstream) to north-west (downstream).