spatstat (version 1.26-0)

linnet: Create a Linear Network

Description

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

Usage

linnet(vertices, m, edges)

Arguments

vertices
Point pattern (object of class "ppp") specifying the vertices of the network.
m
Adjacency matrix. A 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.)

Value

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

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.

This function can take some time to execute, because the algorithm computes various properties of the network that are stored in the resulting object.

See Also

simplenet for an example of a linear network.

methods.linnet for methods applicable to linnet objects. ppp, psp.

Examples

Run this code
# 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)

Run the code above in your browser using DataCamp Workspace