gridadjacencymatrix {spatstat.sparse} | R Documentation |
Create Adjacency Matrix for Spatial Grid
Description
Given the dimensions of a rectangular grid of points, this command creates the adjacency matrix for the corresponding neighbourhood graph, whose vertices are the grid points, and whose edges are the joins between neighbouring grid points.
Usage
gridadjacencymatrix(dims, across = TRUE, down = TRUE, diagonal=TRUE)
Arguments
dims |
Grid dimensions. An integer, or a vector of two integers.
First entry specifies the number of points in the |
across |
Logical value equal to |
down |
Logical value equal to |
diagonal |
Logical value equal to |
Details
If N = prod(dims)
is the total number of grid points,
then the result is an N * N
sparse matrix with logical entries
equal to TRUE
if the corresponding grid points are joined.
Value
A sparse matrix.
Author(s)
Adrian Baddeley.
Examples
gridadjacencymatrix(c(2,3))