Learn R Programming

spNetwork (version 0.1.1)

build_graph: Network generation

Description

Generate an igraph object from a SpatialLinesDataFrame.

Usage

build_graph(lines, digits, line_weight, attrs = FALSE)

Arguments

lines

A SpatialLinesDataFrame

digits

The number of digits to keep from the coordinates

line_weight

The name of a field that represent the cost to use a line

attrs

A Boolean indicating if the original lines attributes must be added to the graph lines

Value

A list containing the following elements:

  • graph: an igraph object that preserves the original lines characteristics

  • linelist: the dataframe used to build the graph

  • lines: the original SpatialLinesDataFrame

  • spvertices: a SpatialPointsDataFrame representing the vertices of the graph

  • digits : the number of digits kept for the coordinates

Examples

Run this code
# NOT RUN {
#This is an internal function, no example provided
# }

Run the code above in your browser using DataLab