Learn R Programming

graph4lg (version 1.8.0)

graph_plan: Create a graph with a minimum planar graph topology

Description

The function constructs a graph with a minimum planar graph topology

Usage

graph_plan(crds, ID = NULL, x = NULL, y = NULL, weight = TRUE)

Value

A planar graph of class igraph

Arguments

crds

A data.frame with the spatial coordinates of the point set (the graph nodes). It must have three columns:

  • ID: A character string indicating the name of the points(graph nodes).

  • x: A numeric or integer indicating the longitude of the graph nodes.

  • y: A numeric or integer indicating the latitude of the graph nodes.

ID

A character string indicating the name of the column of crds with the point IDs

x

A character string indicating the name of the column of crds with the point longitude

y

A character string indicating the name of the column of crds with the point latitude

weight

A character string indicating whether the links of the graph are weighted by Euclidean distances (TRUE)(default) or not (FALSE). When the graph links do not have weights in Euclidean distances, each link is given a weight of 1.

Author

P. Savary

Details

A delaunay triangulation is performed in order to get the planar graph.

Examples

Run this code
data(pts_pop_ex)
g_plan <- graph_plan(crds = pts_pop_ex,
             ID = "ID",
             x = "x",
             y = "y")

Run the code above in your browser using DataLab