Skip to content

Commit

Permalink
rename match_pts_to_graph -> match_pts_to_verts for #103
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Aug 10, 2022
1 parent c90491d commit e849647
Show file tree
Hide file tree
Showing 23 changed files with 79 additions and 88 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dodgr
Title: Distances on Directed Graphs
Version: 0.2.14.082
Version: 0.2.14.083
Authors@R: c(
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre")),
person("Andreas", "Petutschnig", role = "aut"),
Expand Down
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export(dodgr_vertices)
export(estimate_centrality_threshold)
export(estimate_centrality_time)
export(igraph_to_dodgr)
export(match_points_to_graph)
export(match_pts_to_graph)
export(match_points_to_verts)
export(match_pts_to_verts)
export(merge_directed_graph)
export(weight_railway)
export(weight_streetnet)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# v 0.2.14.00X

## Breaking changes:

- `match_pts_to_graph()` renamed to `match_pts_to_verts()`

## Major changes:

- `dodgr_paths` pairwise calculation shifted to C++, thanks to @dcooley
Expand Down
2 changes: 1 addition & 1 deletion R/flows.R
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ nodes_arg_to_pts <- function (nodes,
}
if (ncol (nodes) == 2) {
verts <- dodgr_vertices (graph)
nodes <- verts$id [match_pts_to_graph (verts, nodes)]
nodes <- verts$id [match_pts_to_verts (verts, nodes)]
}
return (nodes)
}
Expand Down
2 changes: 1 addition & 1 deletion R/graph-functions-misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ find_w_col <- function (graph) {
#' find_xy_col_simple
#'
#' Find the x and y cols of a simple data.frame of verts of xy points (used only
#' in match_pts_to_graph).
#' in match_pts_to_verts).
#' @param dfr Either the result of `dodgr_vertices`, or a `data.frame`
#' or equivalent structure (matrix, \pkg{tibble}) of spatial points.
#' @return Vector of two values of location of x and y columns
Expand Down
20 changes: 10 additions & 10 deletions R/graph-match-points.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' match_pts_to_graph
#' match_pts_to_verts
#'
#' Match spatial points to a spatial graph which contains vertex coordinates
#' Match spatial points to the vertices of a spatial graph
#'
#' @param verts A `data.frame` of vertices obtained from
#' `dodgr_vertices(graph)`.
Expand All @@ -26,15 +26,15 @@
#' x = min (verts$x) + runif (npts) * diff (range (verts$x)),
#' y = min (verts$y) + runif (npts) * diff (range (verts$y))
#' )
#' pts <- match_pts_to_graph (verts, xy)
#' pts <- match_pts_to_verts (verts, xy)
#' pts # an index into verts
#' pts <- verts$id [pts]
#' pts # names of those vertices
match_pts_to_graph <- function (verts, xy, connected = FALSE) {
match_pts_to_verts <- function (verts, xy, connected = FALSE) {

if (!all (c ("id", "x", "y") %in% names (verts))) {
message (
"First argument to match_pts_to_graph should be result of ",
"First argument to match_pts_to_verts should be result of ",
"dodgr_vertices;\npresuming you've submitted the network ",
"itself and will now try extracting the vertices"
)
Expand Down Expand Up @@ -80,13 +80,13 @@ match_pts_to_graph <- function (verts, xy, connected = FALSE) {
indx [rcpp_points_index_par (verts, xy) + 1L]
}

#' match_points_to_graph
#' match_points_to_verts
#'
#' Alias for \link{match_points_to_graph}
#' @inherit match_pts_to_graph
#' Alias for \link{match_pts_to_verts}
#' @inherit match_pts_to_verts
#' @family misc
#' @export
match_points_to_graph <- function (verts, xy, connected = FALSE) {
match_points_to_verts <- function (verts, xy, connected = FALSE) {

match_pts_to_graph (verts, xy, connected = connected)
match_pts_to_verts (verts, xy, connected = connected)
}
6 changes: 3 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ it's largest connected component only:
graph <- graph [graph$component == 1, ]
nrow (graph)
```
or by explicitly using the `match_points_to_graph()` function with the option
or by explicitly using the `match_points_to_verts()` function with the option
`connected = TRUE`:
```{r}
from <- match_points_to_graph (v, cbind (from_x, from_y), connected = TRUE)
to <- match_points_to_graph (v, cbind (to_x, to_y), connected = TRUE)
from <- match_points_to_verts (v, cbind (from_x, from_y), connected = TRUE)
to <- match_points_to_verts (v, cbind (to_x, to_y), connected = TRUE)
```
This function returns an index into the result of `dodgr_vertices`, and so
points to use for routing must then be extracted as follows:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,12 @@ graph <- graph [graph$component == 1, ]
nrow (graph)
```

or by explicitly using the `match_points_to_graph()` function with the
or by explicitly using the `match_points_to_verts()` function with the
option `connected = TRUE`:

``` r
from <- match_points_to_graph (v, cbind (from_x, from_y), connected = TRUE)
to <- match_points_to_graph (v, cbind (to_x, to_y), connected = TRUE)
from <- match_points_to_verts (v, cbind (from_x, from_y), connected = TRUE)
to <- match_points_to_verts (v, cbind (to_x, to_y), connected = TRUE)
```

This function returns an index into the result of `dodgr_vertices`, and
Expand Down
23 changes: 5 additions & 18 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository": "https://github.com/ATFutures/dodgr",
"issueTracker": "https://github.com/ATFutures/dodgr/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.2.14.082",
"version": "0.2.14.83",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -339,7 +339,7 @@
},
"SystemRequirements": "C++11, GNU make"
},
"fileSize": "5390.6KB",
"fileSize": "5498.627KB",
"citation": [
{
"@type": "ScholarlyArticle",
Expand All @@ -359,29 +359,16 @@
"@type": "PublicationIssue",
"datePublished": "2019",
"isPartOf": {
"@type": [
"PublicationVolume",
"Periodical"
],
"@type": ["PublicationVolume", "Periodical"],
"name": "Transport Findings"
}
}
}
],
"releaseNotes": "https://github.com/ATFutures/dodgr/blob/master/NEWS.md",
"readme": "https://github.com/ATFutures/dodgr/blob/main/README.md",
"contIntegration": [
"https://github.com/atfutures/dodgr/actions?query=workflow%3AR-CMD-check",
"https://app.codecov.io/gh/ATFutures/dodgr"
],
"contIntegration": ["https://github.com/atfutures/dodgr/actions?query=workflow%3AR-CMD-check", "https://app.codecov.io/gh/ATFutures/dodgr"],
"developmentStatus": "https://www.repostatus.org/#active",
"keywords": [
"distance",
"street-networks",
"shortest-paths",
"r",
"router",
"openstreetmap"
],
"keywords": ["distance", "street-networks", "shortest-paths", "r", "router", "openstreetmap"],
"relatedLink": "https://CRAN.R-project.org/package=dodgr"
}
4 changes: 2 additions & 2 deletions man/compare_heaps.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/dodgr_flowmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/dodgr_full_cycles.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/dodgr_fundamental_cycles.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/dodgr_insert_vertex.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/dodgr_sample.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/dodgr_sflines_to_poly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/dodgr_vertices.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions man/match_points_to_graph.Rd → man/match_points_to_verts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions man/match_pts_to_graph.Rd → man/match_pts_to_verts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/merge_directed_graph.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/summary.dodgr_dists_categorical.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/write_dodgr_wt_profile.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e849647

Please sign in to comment.