66# ' sample is used to estimate timing, by calculating centrality from just a few
77# ' vertices.
88# ' @noRd
9- rcpp_centrality <- function (graph , vert_map_in , heap_type , dist_threshold , edge_centrality , sample ) {
10- .Call (`_dodgr_rcpp_centrality` , graph , vert_map_in , heap_type , dist_threshold , edge_centrality , sample )
9+ rcpp_centrality <- function (graph , vert_map_in , heap_type , dist_threshold , edge_centrality , sample ) {
10+ .Call(`_dodgr_rcpp_centrality` , graph , vert_map_in , heap_type , dist_threshold , edge_centrality , sample )
1111}
1212
1313# ' rcpp_concaveman
14- # ' @noRd
15- rcpp_concaveman <- function (xy , hull_in , concavity , length_threshold ) {
16- .Call (`_dodgr_rcpp_concaveman` , xy , hull_in , concavity , length_threshold )
14+ # ' @noRd
15+ rcpp_concaveman <- function (xy , hull_in , concavity , length_threshold ) {
16+ .Call(`_dodgr_rcpp_concaveman` , xy , hull_in , concavity , length_threshold )
1717}
1818
1919# ' De-duplicate edges by replacing with minimal weighted distances and times
@@ -28,8 +28,8 @@ rcpp_concaveman <- function (xy, hull_in, concavity, length_threshold) {
2828# ' minimal value taken from all duplicated edges. If 't_col' is specified, the
2929# ' equivalent minimal times are in the lower half of the result.
3030# ' @noRd
31- rcpp_deduplicate <- function (graph , fr_col , to_col , d_col , t_col ) {
32- .Call (`_dodgr_rcpp_deduplicate` , graph , fr_col , to_col , d_col , t_col )
31+ rcpp_deduplicate <- function (graph , fr_col , to_col , d_col , t_col ) {
32+ .Call(`_dodgr_rcpp_deduplicate` , graph , fr_col , to_col , d_col , t_col )
3333}
3434
3535# ' Make unordered_set of all new edge names
6464# ' @return Rcpp::List object of `sf::LINESTRING` geoms
6565# '
6666# ' @noRd
67- rcpp_aggregate_to_sf <- function (graph_full , graph_contr , edge_map ) {
68- .Call (`_dodgr_rcpp_aggregate_to_sf` , graph_full , graph_contr , edge_map )
67+ rcpp_aggregate_to_sf <- function (graph_full , graph_contr , edge_map ) {
68+ .Call(`_dodgr_rcpp_aggregate_to_sf` , graph_full , graph_contr , edge_map )
6969}
7070
7171# ' rcpp_flows_aggregate_par
@@ -86,8 +86,8 @@ rcpp_aggregate_to_sf <- function (graph_full, graph_contr, edge_map) {
8686# ' characters long, that chance should be 1 / 62 ^ 10.
8787# '
8888# ' @noRd
89- rcpp_flows_aggregate_par <- function (graph , vert_map_in , fromi , toi_in , flows , norm_sums , tol , heap_type ) {
90- .Call (`_dodgr_rcpp_flows_aggregate_par` , graph , vert_map_in , fromi , toi_in , flows , norm_sums , tol , heap_type )
89+ rcpp_flows_aggregate_par <- function (graph , vert_map_in , fromi , toi_in , flows , norm_sums , tol , heap_type ) {
90+ .Call(`_dodgr_rcpp_flows_aggregate_par` , graph , vert_map_in , fromi , toi_in , flows , norm_sums , tol , heap_type )
9191}
9292
9393# ' rcpp_flows_aggregate_pairwise
@@ -110,8 +110,8 @@ rcpp_flows_aggregate_par <- function (graph, vert_map_in, fromi, toi_in, flows,
110110# ' characters long, that chance should be 1 / 62 ^ 10.
111111# '
112112# ' @noRd
113- rcpp_flows_aggregate_pairwise <- function (graph , vert_map_in , fromi , toi , flows , norm_sums , tol , heap_type ) {
114- .Call (`_dodgr_rcpp_flows_aggregate_pairwise` , graph , vert_map_in , fromi , toi , flows , norm_sums , tol , heap_type )
113+ rcpp_flows_aggregate_pairwise <- function (graph , vert_map_in , fromi , toi , flows , norm_sums , tol , heap_type ) {
114+ .Call(`_dodgr_rcpp_flows_aggregate_pairwise` , graph , vert_map_in , fromi , toi , flows , norm_sums , tol , heap_type )
115115}
116116
117117# ' rcpp_flows_disperse_par
@@ -132,8 +132,8 @@ rcpp_flows_aggregate_pairwise <- function (graph, vert_map_in, fromi, toi, flows
132132# ' between each pair of from and to points.
133133# '
134134# ' @noRd
135- rcpp_flows_disperse_par <- function (graph , vert_map_in , fromi , k , dens , tol , heap_type ) {
136- .Call (`_dodgr_rcpp_flows_disperse_par` , graph , vert_map_in , fromi , k , dens , tol , heap_type )
135+ rcpp_flows_disperse_par <- function (graph , vert_map_in , fromi , k , dens , tol , heap_type ) {
136+ .Call(`_dodgr_rcpp_flows_disperse_par` , graph , vert_map_in , fromi , k , dens , tol , heap_type )
137137}
138138
139139# ' rcpp_flows_si
@@ -149,13 +149,13 @@ rcpp_flows_disperse_par <- function (graph, vert_map_in, fromi, k, dens, tol, he
149149# ' (to-vertices) are not considered.
150150# '
151151# ' @noRd
152- rcpp_flows_si <- function (graph , vert_map_in , fromi , toi_in , kvec , dens_from , dens_to , norm_sums , tol , heap_type ) {
153- .Call (`_dodgr_rcpp_flows_si` , graph , vert_map_in , fromi , toi_in , kvec , dens_from , dens_to , norm_sums , tol , heap_type )
152+ rcpp_flows_si <- function (graph , vert_map_in , fromi , toi_in , kvec , dens_from , dens_to , norm_sums , tol , heap_type ) {
153+ .Call(`_dodgr_rcpp_flows_si` , graph , vert_map_in , fromi , toi_in , kvec , dens_from , dens_to , norm_sums , tol , heap_type )
154154}
155155
156156# ' @noRd
157- rcpp_fundamental_cycles <- function (graph , verts ) {
158- .Call (`_dodgr_rcpp_fundamental_cycles` , graph , verts )
157+ rcpp_fundamental_cycles <- function (graph , verts ) {
158+ .Call(`_dodgr_rcpp_fundamental_cycles` , graph , verts )
159159}
160160
161161# ' get_to_from
170170# ' same_hwy_type
171171# '
172172# ' Determine whether two edges represent the same weight category (type of
173- # ' highway for street networks, for example). Categories are not retained in
173+ # ' highway for street networks, for example). Categories are not retained in
174174# ' converted graphs, but can be discerned by comparing ratios of weighted to
175175# ' non-weighted distances.
176176# ' @noRd
188188# ' original and contracted graph.
189189# '
190190# ' @noRd
191- rcpp_contract_graph <- function (graph , vertlist_in ) {
192- .Call (`_dodgr_rcpp_contract_graph` , graph , vertlist_in )
191+ rcpp_contract_graph <- function (graph , vertlist_in ) {
192+ .Call(`_dodgr_rcpp_contract_graph` , graph , vertlist_in )
193193}
194194
195195# ' rcpp_merge_cols
@@ -203,8 +203,8 @@ rcpp_contract_graph <- function (graph, vertlist_in) {
203203# ' those edges to be retained in the directed graph.
204204# '
205205# ' @noRd
206- rcpp_merge_cols <- function (graph ) {
207- .Call (`_dodgr_rcpp_merge_cols` , graph )
206+ rcpp_merge_cols <- function (graph ) {
207+ .Call(`_dodgr_rcpp_merge_cols` , graph )
208208}
209209
210210# ' sample_one_edge_no_comps
@@ -213,7 +213,7 @@ rcpp_merge_cols <- function (graph) {
213213# ' in \code{sample_one_vertex}
214214# '
215215# ' @param edge_map edge_map
216- # ' @return std::vector of 2 elements: [0] with value of largest connected
216+ # ' @return std::vector of 2 elements: [0] with value of largest connected
217217# ' component; [1] with random index to one edge that is part of that component.
218218# ' @noRd
219219NULL
240240# ' @return Smaller sub-set of \code{graph}
241241# '
242242# ' @noRd
243- rcpp_sample_graph <- function (graph , nverts_to_sample ) {
244- .Call (`_dodgr_rcpp_sample_graph` , graph , nverts_to_sample )
243+ rcpp_sample_graph <- function (graph , nverts_to_sample ) {
244+ .Call(`_dodgr_rcpp_sample_graph` , graph , nverts_to_sample )
245245}
246246
247247# ' graph_has_components
253253
254254# ' @name graph_from_df
255255# '
256- # ' Convert a standard graph data.frame into an object of class graph. Graphs
256+ # ' Convert a standard graph data.frame into an object of class graph. Graphs
257257# ' are standardised with the function \code{dodgr_convert_graph()$graph}, and
258258# ' contain only the four columns [from, to, d, w]
259259# '
@@ -263,7 +263,35 @@ NULL
263263# ' identify_graph_components
264264# '
265265# ' Identify initial graph components for each **vertex**
266- # ' Identification for edges is subsequently perrformed with
266+ # ' Identification for edges is subsequently performed with
267+ # ' \code{rcpp_get_component_vector}.
268+ # '
269+ # ' @param v unordered_map <vertex_id_t, vertex_t>
270+ # ' @param com component map from each vertex to component numbers
271+ # ' @noRd
272+ NULL
273+
274+ # ' strong_connect
275+ # '
276+ # ' Helper function for applying Tarjan's algroithm to identify
277+ # ' strong components recursively
278+ # '
279+ # ' @param vt id of vertex currently being evaluated
280+ # ' @param v unordered_map <vertex_id_t, vertex_t>
281+ # ' @param com component map from each vertex to component numbers
282+ # ' @param index_map map from each vertex to index number
283+ # ' @param lowlink_map map from each vertex to lowlink number
284+ # ' @param on_stack set of all vertices currently on stack
285+ # ' @param s stack used to execute algorithm
286+ # ' @param index used to execute algoritm
287+ # ' @param compnum the current component number
288+ # ' @noRd
289+ NULL
290+
291+ # ' identify_graph_strong_components
292+ # '
293+ # ' Identify initial graph strong components for each **vertex**
294+ # ' Identification for edges is subsequently performed with
267295# ' \code{rcpp_get_component_vector}.
268296# '
269297# ' @param v unordered_map <vertex_id_t, vertex_t>
@@ -278,11 +306,14 @@ NULL
278306# ' @param graph graph to be processed; stripped down and standardised to five
279307# ' columns
280308# '
309+ # ' @param strong A Boolean flag to indicate whether components should be strong,
310+ # ' i.e. its vertices connected bidirectionally. Defaults to FALSE.
311+ # '
281312# ' @return Two vectors: one of edge IDs and one of corresponding component
282313# ' numbers
283314# ' @noRd
284- rcpp_get_component_vector <- function (graph ) {
285- .Call (`_dodgr_rcpp_get_component_vector` , graph )
315+ rcpp_get_component_vector <- function (graph , strong = FALSE ) {
316+ .Call(`_dodgr_rcpp_get_component_vector` , graph , strong )
286317}
287318
288319# ' rcpp_unique_rownames
@@ -291,8 +322,8 @@ rcpp_get_component_vector <- function (graph) {
291322# ' rounded to <precision>. Used when vertices have no ID values.
292323# '
293324# ' @noRd
294- rcpp_unique_rownames <- function (xyfrom , xyto , precision = 10L ) {
295- .Call (`_dodgr_rcpp_unique_rownames` , xyfrom , xyto , precision )
325+ rcpp_unique_rownames <- function (xyfrom , xyto , precision = 10L ) {
326+ .Call(`_dodgr_rcpp_unique_rownames` , xyfrom , xyto , precision )
296327}
297328
298329# ' Determine which side of intersecting line a point lies on.
325356# ' @return 0-indexed Rcpp::NumericVector index into graph of nearest points
326357# '
327358# ' @noRd
328- rcpp_points_index_par <- function (xy , pts ) {
329- .Call (`_dodgr_rcpp_points_index_par` , xy , pts )
359+ rcpp_points_index_par <- function (xy , pts ) {
360+ .Call(`_dodgr_rcpp_points_index_par` , xy , pts )
330361}
331362
332363# ' rcpp_points_to_edges_par
@@ -339,43 +370,43 @@ rcpp_points_index_par <- function (xy, pts) {
339370# ' @return 0-indexed Rcpp::NumericVector index into graph of nearest points
340371# '
341372# ' @noRd
342- rcpp_points_to_edges_par <- function (graph , pts ) {
343- .Call (`_dodgr_rcpp_points_to_edges_par` , graph , pts )
373+ rcpp_points_to_edges_par <- function (graph , pts ) {
374+ .Call(`_dodgr_rcpp_points_to_edges_par` , graph , pts )
344375}
345376
346377# ' rcpp_get_sp_dists_par
347378# '
348379# ' @noRd
349- rcpp_get_sp_dists_par <- function (graph , vert_map_in , fromi , toi_in , heap_type , is_spatial ) {
350- .Call (`_dodgr_rcpp_get_sp_dists_par` , graph , vert_map_in , fromi , toi_in , heap_type , is_spatial )
380+ rcpp_get_sp_dists_par <- function (graph , vert_map_in , fromi , toi_in , heap_type , is_spatial ) {
381+ .Call(`_dodgr_rcpp_get_sp_dists_par` , graph , vert_map_in , fromi , toi_in , heap_type , is_spatial )
351382}
352383
353384# ' rcpp_get_sp_dists_nearest
354385# '
355386# ' @noRd
356- rcpp_get_sp_dists_nearest <- function (graph , vert_map_in , fromi , toi_in , heap_type ) {
357- .Call (`_dodgr_rcpp_get_sp_dists_nearest` , graph , vert_map_in , fromi , toi_in , heap_type )
387+ rcpp_get_sp_dists_nearest <- function (graph , vert_map_in , fromi , toi_in , heap_type ) {
388+ .Call(`_dodgr_rcpp_get_sp_dists_nearest` , graph , vert_map_in , fromi , toi_in , heap_type )
358389}
359390
360391# ' rcpp_get_sp_dists_paired_par
361392# '
362393# ' @noRd
363- rcpp_get_sp_dists_paired_par <- function (graph , vert_map_in , fromi , toi , heap_type , is_spatial ) {
364- .Call (`_dodgr_rcpp_get_sp_dists_paired_par` , graph , vert_map_in , fromi , toi , heap_type , is_spatial )
394+ rcpp_get_sp_dists_paired_par <- function (graph , vert_map_in , fromi , toi , heap_type , is_spatial ) {
395+ .Call(`_dodgr_rcpp_get_sp_dists_paired_par` , graph , vert_map_in , fromi , toi , heap_type , is_spatial )
365396}
366397
367398# ' rcpp_get_iso
368399# '
369400# ' @noRd
370- rcpp_get_iso <- function (graph , vert_map_in , fromi , dlim , heap_type ) {
371- .Call (`_dodgr_rcpp_get_iso` , graph , vert_map_in , fromi , dlim , heap_type )
401+ rcpp_get_iso <- function (graph , vert_map_in , fromi , dlim , heap_type ) {
402+ .Call(`_dodgr_rcpp_get_iso` , graph , vert_map_in , fromi , dlim , heap_type )
372403}
373404
374405# ' rcpp_get_sp_dists
375406# '
376407# ' @noRd
377- rcpp_get_sp_dists <- function (graph , vert_map_in , fromi , toi_in , heap_type ) {
378- .Call (`_dodgr_rcpp_get_sp_dists` , graph , vert_map_in , fromi , toi_in , heap_type )
408+ rcpp_get_sp_dists <- function (graph , vert_map_in , fromi , toi_in , heap_type ) {
409+ .Call(`_dodgr_rcpp_get_sp_dists` , graph , vert_map_in , fromi , toi_in , heap_type )
379410}
380411
381412# ' rcpp_get_paths
@@ -396,12 +427,12 @@ rcpp_get_sp_dists <- function (graph, vert_map_in, fromi, toi_in, heap_type) {
396427# ' @note Returns 1-indexed values indexing directly into the R input
397428# '
398429# ' @noRd
399- rcpp_get_paths <- function (graph , vert_map_in , fromi , toi_in , heap_type ) {
400- .Call (`_dodgr_rcpp_get_paths` , graph , vert_map_in , fromi , toi_in , heap_type )
430+ rcpp_get_paths <- function (graph , vert_map_in , fromi , toi_in , heap_type ) {
431+ .Call(`_dodgr_rcpp_get_paths` , graph , vert_map_in , fromi , toi_in , heap_type )
401432}
402433
403- rcpp_get_paths_pairwise <- function (graph , vert_map_in , fromi , toi_in , heap_type ) {
404- .Call (`_dodgr_rcpp_get_paths_pairwise` , graph , vert_map_in , fromi , toi_in , heap_type )
434+ rcpp_get_paths_pairwise <- function (graph , vert_map_in , fromi , toi_in , heap_type ) {
435+ .Call(`_dodgr_rcpp_get_paths_pairwise` , graph , vert_map_in , fromi , toi_in , heap_type )
405436}
406437
407438# ' rcpp_get_sp_dists_categorical
@@ -413,21 +444,21 @@ rcpp_get_paths_pairwise <- function (graph, vert_map_in, fromi, toi_in, heap_typ
413444# ' Implemented in parallal form only; no single-threaded version, and
414445# ' only for AStar (so graphs must be spatial).
415446# ' @noRd
416- rcpp_get_sp_dists_categorical <- function (graph , vert_map_in , fromi , toi_in , heap_type , proportions_only ) {
417- .Call (`_dodgr_rcpp_get_sp_dists_categorical` , graph , vert_map_in , fromi , toi_in , heap_type , proportions_only )
447+ rcpp_get_sp_dists_categorical <- function (graph , vert_map_in , fromi , toi_in , heap_type , proportions_only ) {
448+ .Call(`_dodgr_rcpp_get_sp_dists_categorical` , graph , vert_map_in , fromi , toi_in , heap_type , proportions_only )
418449}
419450
420451# ' rcpp_get_sp_dists_categ_paired
421452# '
422453# ' Pairwise version of 'get_sp_dists_categorical'. The `graph` must have an
423- # ' `edge_type` column of non-negative integers, with 0 denoting edges which are
454+ # '`edge_type` column of non-negative integers, with 0 denoting edges which are
424455# ' not aggregated, and all other values defining aggregation categories.
425456# '
426457# ' Implemented in parallal form only; no single-threaded version, and
427458# ' only for AStar (so graphs must be spatial).
428459# ' @noRd
429- rcpp_get_sp_dists_categ_paired <- function (graph , vert_map_in , fromi , toi_in , heap_type ) {
430- .Call (`_dodgr_rcpp_get_sp_dists_categ_paired` , graph , vert_map_in , fromi , toi_in , heap_type )
460+ rcpp_get_sp_dists_categ_paired <- function (graph , vert_map_in , fromi , toi_in , heap_type ) {
461+ .Call(`_dodgr_rcpp_get_sp_dists_categ_paired` , graph , vert_map_in , fromi , toi_in , heap_type )
431462}
432463
433464# ' rcpp_get_sp_dists_cat_threshold
@@ -439,17 +470,17 @@ rcpp_get_sp_dists_categ_paired <- function (graph, vert_map_in, fromi, toi_in, h
439470# ' Implemented in parallal form only; no single-threaded version, and
440471# ' only for AStar (so graphs must be spatial).
441472# ' @noRd
442- rcpp_get_sp_dists_cat_threshold <- function (graph , vert_map_in , fromi , dlimit , heap_type ) {
443- .Call (`_dodgr_rcpp_get_sp_dists_cat_threshold` , graph , vert_map_in , fromi , dlimit , heap_type )
473+ rcpp_get_sp_dists_cat_threshold <- function (graph , vert_map_in , fromi , dlimit , heap_type ) {
474+ .Call(`_dodgr_rcpp_get_sp_dists_cat_threshold` , graph , vert_map_in , fromi , dlimit , heap_type )
444475}
445476
446477# ' rcpp_gen_hash
447478# '
448479# ' Efficient generation of long sequences of hash keys
449480# '
450481# ' @noRd
451- rcpp_gen_hash <- function (n , hash_len ) {
452- .Call (`_dodgr_rcpp_gen_hash` , n , hash_len )
482+ rcpp_gen_hash <- function (n , hash_len ) {
483+ .Call(`_dodgr_rcpp_gen_hash` , n , hash_len )
453484}
454485
455486# ' rcpp_sf_as_network
@@ -475,13 +506,14 @@ rcpp_gen_hash <- function (n, hash_len) {
475506# ' 4. OSM way ID
476507# '
477508# ' @noRd
478- rcpp_sf_as_network <- function (sf_lines , pr ) {
479- .Call (`_dodgr_rcpp_sf_as_network` , sf_lines , pr )
509+ rcpp_sf_as_network <- function (sf_lines , pr ) {
510+ .Call(`_dodgr_rcpp_sf_as_network` , sf_lines , pr )
480511}
481512
482513# ' rcpp_route_times
483514# '
484515# ' @noRd
485- rcpp_route_times <- function (graph , left_side , turn_penalty ) {
486- .Call (`_dodgr_rcpp_route_times` , graph , left_side , turn_penalty )
516+ rcpp_route_times <- function (graph , left_side , turn_penalty ) {
517+ .Call(`_dodgr_rcpp_route_times` , graph , left_side , turn_penalty )
487518}
519+
0 commit comments