Distances on Directed Graphs in R
1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/graph-functions.R
3\name{dodgr_sample}
4\alias{dodgr_sample}
5\title{Sample a random but connected sub-component of a graph}
6\usage{
7dodgr_sample(graph, nverts = 1000)
8}
9\arguments{
10\item{graph}{A flat table of graph edges. Must contain columns labelled
11\code{from} and \code{to}, or \code{start} and \code{stop}. May also contain
12similarly labelled columns of spatial coordinates (for example
13\code{from_x}) or \code{stop_lon}).}
14
15\item{nverts}{Number of vertices to sample}
16}
17\value{
18A connected sub-component of \code{graph}
19}
20\description{
21Sample a random but connected sub-component of a graph
22}
23\note{
24Graphs may occasionally have \code{nverts + 1} vertices, rather than
25the requested \code{nverts}.
26}
27\examples{
28graph <- weight_streetnet (hampi)
29nrow (graph) # 5,742
30graph <- dodgr_sample (graph, nverts = 200)
31nrow (graph) # generally around 400 edges
32nrow (dodgr_vertices (graph)) # 200
33}
34\seealso{
35Other misc:
36\code{\link{compare_heaps}()},
37\code{\link{dodgr_flowmap}()},
38\code{\link{dodgr_full_cycles}()},
39\code{\link{dodgr_fundamental_cycles}()},
40\code{\link{dodgr_insert_vertex}()},
41\code{\link{dodgr_sflines_to_poly}()},
42\code{\link{dodgr_vertices}()},
43\code{\link{merge_directed_graph}()},
44\code{\link{summary.dodgr_dists_categorical}()},
45\code{\link{write_dodgr_wt_profile}()}
46}
47\concept{misc}