Skip to content

Commit

Permalink
spaceout vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Jan 13, 2023
1 parent 97dd7aa commit e96ad90
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 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.18.005
Version: 0.2.18.006
Authors@R: c(
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre")),
person("Andreas", "Petutschnig", role = "aut"),
Expand Down
2 changes: 1 addition & 1 deletion 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.18.005",
"version": "0.2.18.006",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
22 changes: 14 additions & 8 deletions vignettes/times.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ these routing vertices as illustrated in the following example:
dat_sc <- dodgr_streetnet_sc ("ogbomosho nigeria")
graph <- weight_streetnet (dat_sc, wt_profile = "bicycle")
graph_t <- weight_streetnet (dat_sc, wt_profile = "bicycle", turn_penalty = TRUE)
nrow (graph); nrow (graph_t)
nrow (graph)
nrow (graph_t)
```
```{r streetnet_times-out1, echo = FALSE}
c (164168, 173160)
Expand All @@ -189,7 +190,8 @@ turn penalties, and will be matched on to the corresponding nodes appended with
will generally be quicker to first contract the graph prior to routing.
```{r routing, eval = FALSE}
graph_tc <- dodgr_contract_graph (graph_t)
nrow (graph_tc); nrow (graph_t)
nrow (graph_tc)
nrow (graph_t)
```
```{r routing-out, echo = FALSE}
c (35808, 176160)
Expand Down Expand Up @@ -256,9 +258,11 @@ from <- sample (graph$from_id, size = n)
to <- sample (graph$from_id, size = n)
d_dist <- dodgr_dists (graph, from = from, to = to, shortest = TRUE) # default
d_time <- dodgr_dists (graph, from = from, to = to, shortest = FALSE) # fastest paths
plot (d_dist / 1000, d_time / 1000, col = "orange",
xlab = "distances along shortest paths (km)",
ylab = "distances along fastest paths (km)")
plot (d_dist / 1000, d_time / 1000,
col = "orange",
xlab = "distances along shortest paths (km)",
ylab = "distances along fastest paths (km)"
)
lines (0:100, 0:100, col = "red", lty = 2)
```

Expand Down Expand Up @@ -296,9 +300,11 @@ function:
```{r shortest-vs-fastest-times}
t_dist <- dodgr_times (graph, from = from, to = to, shortest = TRUE) # default
t_time <- dodgr_times (graph, from = from, to = to, shortest = FALSE) # fastest paths
plot (t_dist / 3600, t_time / 3600, col = "orange",
xlab = "times along shortest paths (hours)",
ylab = "times along fastest paths (hours)")
plot (t_dist / 3600, t_time / 3600,
col = "orange",
xlab = "times along shortest paths (hours)",
ylab = "times along fastest paths (hours)"
)
lines (0:100, 0:100, col = "red", lty = 2)
mean (abs (t_time - t_dist), na.rm = TRUE)
```
Expand Down

0 comments on commit e96ad90

Please sign in to comment.