File: gridadjacencymatrix.Rd

package info (click to toggle)
r-cran-spatstat.sparse 3.1-0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 312 kB
  • sloc: ansic: 442; sh: 13; makefile: 2
file content (47 lines) | stat: -rw-r--r-- 1,273 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
\name{gridadjacencymatrix}
\alias{gridadjacencymatrix}
\title{
  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{
  \item{dims}{
    Grid dimensions. An integer, or a vector of two integers.
    First entry specifies the number of points in the \eqn{y} direction.
  }
  \item{across}{
    Logical value equal to \code{TRUE} if horizontal neighbours should
    be joined.
  }
  \item{down}{
    Logical value equal to \code{TRUE} if vertical neighbours should
    be joined.
  }
  \item{diagonal}{
    Logical value equal to \code{TRUE} if diagonal neighbours should
    be joined.
  }
}
\details{
  If \code{N = prod(dims)} is the total number of grid points,
  then the result is an \code{N * N} sparse matrix with logical entries
  equal to \code{TRUE} if the corresponding grid points are joined.
}
\value{
  A sparse matrix. 
}
\author{
  Adrian Baddeley.
}
\examples{
  gridadjacencymatrix(c(2,3))  
}
\keyword{datagen}