You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.Rmd
+51-3Lines changed: 51 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "cppRouting package"
2
+
title: "cppRouting package v1.2"
3
3
author: "Vincent LARMET"
4
4
date: "July 6, 2019"
5
5
output: github_document
@@ -57,14 +57,19 @@ Data has to be a 3 columns data.frame or matrix containing from, to and a cost/d
57
57
-`get_multi_paths` : compute shortest paths between all origin nodes and all destination nodes (*one-to-many*),
58
58
-`get_isochrone` : compute isochrones/isodistances with one or multiple breaks.
59
59
-`cpp_simplify` : remove non-intersection nodes, duplicated edges and isolated loops in the graph. Graph topology is preserved so distance calculation is faster and remains true. This function can be applied to very large graphs (several millions of nodes).
60
+
-`get_detour` : return nodes that are reachable within a fixed additional cost around shortest paths. This function can be useful in producing accessibility indicators.
60
61
61
62
62
63
###Path algorithms
63
64
The choice between all the algorithms is available for *one-to-one* calculation like `get_distance_pair` and `get_path_pair`.
64
65
In these functions, uni-directional Dijkstra algorithm is stopped when the destination node is reached.
65
66
`A*` and `NBA*` are relevant if geographic coordinates of all nodes are provided. Note that coordinates should be expressed in a **projection system**.
66
67
To be accurate and efficient, `A*` and `NBA*` algorithms should use an admissible heuristic function (here the Euclidean distance), e.g cost and heuristic function must be expressed in the same unit.
67
-
In `cppRouting`, heuristic function `h` is defined such that : h(xi,yi,xdestination,ydestination)/k, with a constant k; so in the case where coordinates are expressed in meters and cost is expressed in time, k is the maximum speed allowed on the road. By default, constant is 1 and is designed for graphs with cost expressed in the same unit than coordinates (for example in meters).
68
+
In `cppRouting`, heuristic function `h` for a node (n) is defined such that :
69
+
**h(n,d) = ED(n,d) / k**
70
+
with *h* the heuristic, *ED* the Euclidean distance, *d* the destination node and a constant *k*.
71
+
72
+
So in the case where coordinates are expressed in meters and cost is expressed in time, *k* is the maximum speed allowed on the road. By default, constant is 1 and is designed for graphs with cost expressed in the same unit than coordinates (for example in meters).
68
73
69
74
If coordinates cannot be provided, bi-directional Dijkstra algorithm can offer a good alternative to A* in terms of performance.
70
75
@@ -186,12 +191,56 @@ p<-ggmap(dijon)+
186
191
p
187
192
188
193
```
194
+
195
+
196
+
###Compute possible detours within a fixed additional cost
197
+
`get_detour` function returns all reachable nodes within a fixed detour time around the shortest path between origin and destination nodes. Returned nodes (n) meet the following condition :
198
+
**SP(o,n) + SP(n,d) < SP(o,d) + t**
199
+
with *SP* shortest distance/time, *o* the origin node, *d* the destination node and *t* the extra cost.
200
+
The algorithm used is a slightly modified bidirectional Dijkstra.
201
+
Let's see an example for the path between Dijon and Lyon city :
Copy file name to clipboardExpand all lines: README.md
+75-28Lines changed: 75 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
cppRouting package
1
+
cppRouting package v1.2
2
2
================
3
3
Vincent LARMET
4
4
July 6, 2019
@@ -59,14 +59,18 @@ Main functions
59
59
-`get_multi_paths` : compute shortest paths between all origin nodes and all destination nodes (*one-to-many*),
60
60
-`get_isochrone` : compute isochrones/isodistances with one or multiple breaks.
61
61
-`cpp_simplify` : remove non-intersection nodes, duplicated edges and isolated loops in the graph. Graph topology is preserved so distance calculation is faster and remains true. This function can be applied to very large graphs (several millions of nodes).
62
+
-`get_detour` : return nodes that are reachable within a fixed additional cost around shortest paths. This function can be useful in producing accessibility indicators.
62
63
63
64
### Path algorithms
64
65
65
66
The choice between all the algorithms is available for *one-to-one* calculation like `get_distance_pair` and `get_path_pair`.
66
67
In these functions, uni-directional Dijkstra algorithm is stopped when the destination node is reached.
67
68
`A*` and `NBA*` are relevant if geographic coordinates of all nodes are provided. Note that coordinates should be expressed in a **projection system**.
68
69
To be accurate and efficient, `A*` and `NBA*` algorithms should use an admissible heuristic function (here the Euclidean distance), e.g cost and heuristic function must be expressed in the same unit.
69
-
In `cppRouting`, heuristic function `h` is defined such that : h(xi,yi,xdestination,ydestination)/k, with a constant k; so in the case where coordinates are expressed in meters and cost is expressed in time, k is the maximum speed allowed on the road. By default, constant is 1 and is designed for graphs with cost expressed in the same unit than coordinates (for example in meters).
70
+
In `cppRouting`, heuristic function `h` for a node (n) is defined such that :
71
+
**h(n,d) = ED(n,d) / k** with *h* the heuristic, *ED* the Euclidean distance, *d* the destination node and a constant *k*.
72
+
73
+
So in the case where coordinates are expressed in meters and cost is expressed in time, *k* is the maximum speed allowed on the road. By default, constant is 1 and is designed for graphs with cost expressed in the same unit than coordinates (for example in meters).
70
74
71
75
If coordinates cannot be provided, bi-directional Dijkstra algorithm can offer a good alternative to A\* in terms of performance.
### Compute possible detours within a fixed additional cost
256
+
257
+
`get_detour` function returns all reachable nodes within a fixed detour time around the shortest path between origin and destination nodes. Returned nodes (n) meet the following condition :
258
+
**SP(o,n) + SP(n,d) < SP(o,d) + t**
259
+
with *SP* shortest distance/time, *o* the origin node, *d* the destination node and *t* the extra cost.
260
+
The algorithm used is a slightly modified bidirectional Dijkstra.
261
+
Let's see an example for the path between Dijon and Lyon city :
Here, junction nodes are `e`, `h`, `d`, `k`, `l`, `i` and `m`. So `b`, `c`, `f` and `n` have been contracted in the first step of the function. By contracting `n`, an edge with cost of 2 has been created between `m` and `l` nodes.
301
349
The second step of the function has removed this edge which is greater than the original one (e.g 1), and the whole process now need a second iteration to remove `m` and `l` that aren't intersection nodes anymore.
@@ -321,7 +369,7 @@ plot(igr4,edge.arrow.size=.3,edge.label=E(igr4)$dist,main="Second iteration - re
0 commit comments