# linnet: Create a Linear Network In spatstat: Spatial Point Pattern Analysis, Model-Fitting, Simulation, Tests

## Description

Creates an object of class `"linnet"` representing a network of line segments.

## Usage

 `1` ```linnet(vertices, m, edges, sparse=FALSE, warn=TRUE) ```

## Arguments

 `vertices` Point pattern (object of class `"ppp"`) specifying the vertices of the network. `m` Adjacency matrix. A matrix or sparse matrix of logical values equal to `TRUE` when the corresponding vertices are joined by a line. (Specify either `m` or `edges`.) `edges` Edge list. A two-column matrix of integers, specifying all pairs of vertices that should be joined by an edge. (Specify either `m` or `edges`.) `sparse` Optional. Logical value indicating whether to use a sparse matrix representation of the network. See Details. `warn` Logical value indicating whether to issue a warning if the resulting network is not connected.

## Details

An object of class `"linnet"` represents a network of straight line segments in two dimensions. The function `linnet` creates such an object from the minimal information: the spatial location of each vertex (endpoint, crossing point or meeting point of lines) and information about which vertices are joined by an edge.

If `sparse=FALSE` (the default), the algorithm will compute and store various properties of the network, including the adjacency matrix `m` and a matrix giving the shortest-path distances between each pair of vertices in the network. This is more efficient for small datasets. However it can require large amounts of memory and can take a long time to execute.

If `sparse=TRUE`, then the shortest-path distances will not be computed, and the network adjacency matrix `m` will be stored as a sparse matrix. This saves a lot of time and memory when creating the linear network.

If the argument `edges` is given, then it will also determine the ordering of the line segments when they are stored or extracted. For example, `edges[i,]` corresponds to `as.psp(L)[i]`.

## Value

Object of class `"linnet"` representing the linear network.

## Author(s)

Ang Qi Wei [email protected] and \adrian

`simplenet` for an example of a linear network.

`methods.linnet` for methods applicable to `linnet` objects.

Special tools: `thinNetwork`, `insertVertices`, `joinVertices`, `connected.linnet`, `lixellate`.

`delaunayNetwork` for the Delaunay triangulation as a network.

`ppp`, `psp`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ``` # letter 'A' specified by adjacency matrix v <- ppp(x=(-2):2, y=3*c(0,1,2,1,0), c(-3,3), c(-1,7)) m <- matrix(FALSE, 5,5) for(i in 1:4) m[i,i+1] <- TRUE m[2,4] <- TRUE m <- m | t(m) letterA <- linnet(v, m) plot(letterA) # letter 'A' specified by edge list edg <- cbind(1:4, 2:5) edg <- rbind(edg, c(2,4)) letterA <- linnet(v, edges=edg) ```

### Example output

```Loading required package: nlme

spatstat 1.52-1       (nickname: 'Apophenia')
For an introduction to spatstat, type 'beginner'

Note: spatstat version 1.52-1 is out of date by more than 3 months; we recommend upgrading to the latest version.
```

spatstat documentation built on Nov. 5, 2018, 1:04 a.m.