# nnwhich.lpp

From spatstat v1.42-2
by Adrian Baddeley

##### Identify Nearest Neighbours on a Linear Network

Given a pattern of points on a linear network, identify the nearest neighbour for each point, measured by the shortest path in the network.

- Keywords
- spatial

##### Usage

```
## S3 method for class 'lpp':
nnwhich(X, ..., method="C")
```

##### Arguments

- X
- Point pattern on linear network (object of class
`"lpp"`

). - method
- Optional string determining the method of calculation.
Either
`"interpreted"`

or`"C"`

. - ...
- Ignored.

##### Details

Given a pattern of points on a linear network,
this function finds the nearest neighbour of each point
(i.e. for each point it identifies the nearest other point)
measuring distance by the shortest path in the network.
If `method="C"`

the task is performed using
code in the C language. If `method="interpreted"`

then the
computation is performed using interpreted Rcode. The Rcode is
much slower, but is provided for checking purposes.

##### Value

- An integer vector, of length equal to the number of points in
`X`

, identifying the nearest neighbour of each point. If`nnwhich(X)[2] = 4`

then the nearest neighbour of point 2 is point 4.

##### See Also

##### Examples

```
example(lpp)
nnwhich(X)
```

*Documentation reproduced from package spatstat, version 1.42-2, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.