# connected.lpp

##### Connected Components of a Point Pattern on a Linear Network

Finds the topologically-connected components of a point pattern on a linear network, when all pairs of points closer than a threshold distance are joined.

##### Usage

```
# S3 method for lpp
connected(X, R=Inf, …, dismantle=TRUE)
```

##### Arguments

- X
A linear network (object of class

`"lpp"`

).- R
Threshold distance. Pairs of points will be joined together if they are closer than

`R`

units apart, measured by the shortest path in the network. The default`R=Inf`

implies that points will be joined together if they are mutually connected by any path in the network.- dismantle
Logical. If

`TRUE`

(the default), the network itself will be divided into its path-connected components using`connected.linnet`

.- …
Ignored.

##### Details

The function `connected`

is generic. This is the method for
point patterns on a linear network (objects of class `"lpp"`

).
It divides the point pattern `X`

into one or more groups of points.

If `R=Inf`

(the default), then `X`

is divided into groups
such that any pair of points in the same group
can be joined by a path in the network.

If `R`

is a finite number, then two points of `X`

are
declared to be *R-close* if they lie closer than
`R`

units apart, measured by the length of the shortest path in the
network. Two points are *R-connected* if they
can be reached by a series of steps between R-close pairs of
points of `X`

. Then `X`

is divided into groups such that
any pair of points in the same group is R-connected.

If `dismantle=TRUE`

(the default) the algorithm first checks
whether the network is connected (i.e. whether any pair of vertices
can be joined by a path in the network), and if not, the network is
decomposed into its connected components.

##### Value

A point pattern (of class `"lpp"`

) with marks indicating the
grouping, or a list of such point patterns.

##### See Also

##### Examples

```
# NOT RUN {
## behaviour like connected.ppp
U <- runiflpp(20, simplenet)
plot(connected(U, 0.15, dismantle=FALSE))
## behaviour like connected.owin
## remove some edges from a network to make it disconnected
plot(simplenet, col="grey", main="", lty=2)
A <- thinNetwork(simplenet, retainedges=-c(3,5))
plot(A, add=TRUE, lwd=2)
X <- runiflpp(10, A)
## find the connected components
cX <- connected(X)
plot(cX[[1]], add=TRUE, col="blue", lwd=2)
# }
```

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