st_nb_delaunay: Graph based neighbors

View source: R/nb-graph.R

st_nb_delaunayR Documentation

Graph based neighbors

Description

Create graph based neighbors on a set of points.

Usage

st_nb_delaunay(geometry, .id = NULL)

st_nb_gabriel(geometry, .nnmult = 3)

st_nb_relative(geometry, .nnmult = 3)

Arguments

geometry

an object of class sfc. If polygons are used, points are generated using sf::st_point_on_surface().

.id

default NULL. Passed as spdep::tri2nb(x, row.names = .id) to spdep.

.nnmult

default 3. Used for memory scalling. See spdep::gabrielneigh() for more.

Details

  • st_nb_delaunay() uses spdep::tri2nb()

  • st_nb_gabriel() uses spdep::gabrielneigh() and spdep::graph2nb()

  • st_nb_relative() uses spdep::relativeneigh() and spdep::graph2nb()

st_nb_delaunay() implements Delaunay triangulation via spdep and thus via deldir. Delaunay triangulation creates a mesh of triangles that connects all points in a set. It ensures that no point is in in the circumcircle of an triangle in the triangulation. As a result, Delaunay triangulation maximizes the minimum angle in each triangle consequently avoiding skinny triangles.

The Gabriel graph is a subgraph of the Delaunay triangulation. Edges are created when the closed disc between two points p, and q, contain no other points besides themselves.

The relative neighborhood graph (RNG) is based on the Delaunay triangulation. It connects two points when there are no other closer points to each of them. The RNG is a subgraph of the Delaunay triangulation.

Note that Delaunay triangulation assumes a plane and thus uses Euclidean distances.

See spdep::gabrielneigh() for further descriptions of the graph neighbor implementations.

Value

an object of class nb

Examples

geometry <- sf::st_centroid(sf::st_geometry(guerry))
st_nb_delaunay(geometry)
st_nb_gabriel(geometry)
st_nb_relative(geometry)

sfdep documentation built on Sept. 13, 2024, 5:07 p.m.