graph.metrics: Graph Metrics

View source: R/graph.metrics.R

graph.metricsR Documentation

Graph Metrics

Description

Metrics on structural properties of graph (at nodes)

Usage

graph.metrics(
  x,
  node.pts,
  node.name = NULL,
  direct = FALSE,
  metric = c("betweenness", "degree", "closeness")
)

Arguments

x

knn graph object from GeNetIt::knn.graph (sf LINESTRING)

node.pts

sf POINT or sp SpatialPointsDataFrame object used as nodes to build x

node.name

Column name in node.pts object that acts as the provides the unique ID. If not defined, defaults to row.names of node.pts

direct

(FALSE/TRUE) Evaluate directed graph

metric

...

Note

Please note; graph metrics are not valid for a saturated graph (all connections)

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org> and Melanie A. Murphy <melanie.murphy@uwyo.edu>

Examples

 library(sf)
 data(ralu.site, package="GeNetIt")

 graph <- knn.graph(ralu.site, row.names=ralu.site$SiteName, 
                   max.dist = 2500)
     plot(st_geometry(graph))

 ( m <- graph.metrics(graph, ralu.site, "SiteName") )
 
  ralu.site <- merge(ralu.site, m, by="SiteName")
    # plot node betweenness
    plot(st_geometry(graph), col="grey")
   plot(ralu.site["betweenness"], pch=19, cex=1.25, add=TRUE)
# plot node degree
    plot(st_geometry(graph), col="grey")
   plot(ralu.site["degree"], pch=19, cex=1.25, add=TRUE)	   


GeNetIt documentation built on July 9, 2023, 5:18 p.m.