shapegraphToGraphData: Conversion of shapegraph to graph data

View source: R/shapegraphToGraphData.R

shapegraphToGraphDataR Documentation

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)

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.

Value

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

Examples

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)

alcyon documentation built on April 3, 2025, 6:18 p.m.