Learn R Programming

alcyon (version 0.7.0)

shapegraphToGraphData: Conversion of shapegraph to graph data

Description

Creates data to be construct a graph, based on the connections and the x,y coordinates of the centroids of shapes in a shapegraph (axial, segment, convex). Specify weightColumn to assign weight to graph edges.

Usage

shapegraphToGraphData(shapeGraph, weightColumn = NA)

Value

Returns a list with edges and vertices for constructing a graph.

Arguments

shapeGraph

A ShapeGraph

weightColumn

Optional. The variable used to assign weight to graph edges

Details

If weightColumn is provided, edge connections weight is calculated by taking the average of the variable of the connected nodes.

Examples

Run this code
mifFile <- system.file(
    "extdata", "testdata", "barnsbury",
    "barnsbury_small_axial_original.mif",
    package = "alcyon"
  )
  sfMap <- st_read(mifFile,
    geometry_column = 1L, quiet = TRUE
  )
  shapeGraph <- as(sfMap, "AxialShapeGraph")
shapegraphToGraphData(shapeGraph)

Run the code above in your browser using DataLab