# spatgraph: Compute the edges of a spatial graph In antiphon/spatgraphs: Graph Edge Computations for Spatial Point Patterns

## Description

Given a spatial point pattern, we compute the edges of a graph (network) for a specified type of edge relationship.

## Usage

 ```1 2``` ```spatgraph(x, type = "geometric", par = NULL, verbose = FALSE, maxR = 0, doDists = FALSE, preGraph = NULL) ```

## Arguments

 `x` Input point pattern object `type` Type of the graph `par` Parameter(s) for the graph `verbose` Print details `maxR` Maximum range for edges, helps in large patterns. `doDists` Precompute distances? Speeds up some graphs, takes up memory. `preGraph` Precomputed graph, taken as a super-graph

## Details

Several edge definitions are supported:

geometric

par=numeric>0. Geometric graph, par = connection radius.

knn

par=integer>0. k-nearest neighbours graph, par = k.

mass_geometric

Connect two points if ||x-y||<m(x). par=vector giving the m(x_i)'s

markcross

Connect two points if ||x-y||<m(x)+m(y). par = vector giving the m(x_i)'s

gabriel

Gabriel graph. Additional parameter for allowing `par=k` instead of 0 points in the circle.

MST

Minimal spanning tree.

SIG

Spheres of Influence.

RST

RNG

Relative neighbourhood graph

CCC

Class-Cover-Catch, par=factor vector of point types. The factor vector is converted to integers according to R's internal representation of factors, and the points with type 1 will be the target. Use relevel to change the target.

The parameter 'maxR' can be given to bring n^3 graphs closer to n^2. k-nearest neighbours will warn if maxR is too small (<k neighbours for some points), others, like RNG, don't so be careful.

Voronoi diagram aka Delaunay triangulation is not supported as other R-packages can do it, see. e.g. package 'deldir'.

## Examples

 ```1 2 3 4 5 6 7 8``` ```# basic example x <- matrix(runif(50*2), ncol=2) g <- spatgraph(x, "knn", par=3) plot(g, x) # bigger example xb <- matrix(runif(5000*2), ncol=2) gb <- spatgraph(xb, "RNG", maxR=0.1) ```

antiphon/spatgraphs documentation built on Dec. 15, 2017, 6:33 p.m.