Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dodgr_contract_graph

dodgr_contract_graph


Description

Removes redundant (straight-line) vertices from graph, leaving only junction vertices.

Usage

dodgr_contract_graph(graph, verts = NULL)

Arguments

graph

A flat table of graph edges. Must contain columns labelled from and to, or start and stop. May also contain similarly labelled columns of spatial coordinates (for example from_x) or stop_lon).

verts

Optional list of vertices to be retained as routing points. These must match the from and to columns of graph.

Value

A contracted version of the original graph, containing the same number of columns, but with each row representing an edge between two junction vertices (or between the submitted verts, which may or may not be junctions).

See Also

Other modification: dodgr_components(), dodgr_uncontract_graph()

Examples

graph <- weight_streetnet (hampi)
nrow (graph) # 5,973
graph <- dodgr_contract_graph (graph)
nrow (graph) # 662

dodgr

Distances on Directed Graphs

v0.2.11
GPL-3
Authors
Mark Padgham [aut, cre], Andreas Petutschnig [aut], Robin Lovelace [ctb], Andrew Smith [ctb], Malcolm Morgan [ctb], Shane Saunders [cph] (Original author of included code for priority heaps)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.