dodgr_sample: dodgr_sample

Description Usage Arguments Value Note Examples

Description

Sample a random but connected sub-component of a graph

Usage

1
dodgr_sample(graph, nverts = 1000)

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).

nverts

Number of vertices to sample

Value

A connected sub-component of graph

Note

Graphs may occasionally have nverts + 1 vertices, rather than the requested nverts.

Examples

1
2
3
4
5
graph <- weight_streetnet (hampi)
nrow (graph) # 5,742
graph <- dodgr_sample (graph, nverts = 200)
nrow (graph) # generally around 400 edges
nrow (dodgr_vertices (graph)) # 200

dodgr documentation built on Aug. 8, 2021, 1:06 a.m.