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: R/contract.R
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
#' Contraction hierarchies algorithm
2
2
#' @description Contract a graph by using contraction hierarchies algorithm
3
-
#' @param Graph An object generated by cppRouting::makegraph() function.
3
+
#' @param Graph An object generated by makegraph() or cpp_simplify() function.
4
4
#' @param silent Logical. If TRUE, progress is not displayed.
5
5
#' @return A contracted graph.
6
6
#' @details Contraction hierarchy is a speed-up technique for finding shortest path in a graph.
7
7
#' It consist of two steps : preprocessing phase and query. cpp_contract() preprocess the input graph to later use special query algorithm implemented in get_distance_pair(),get_distance_matrix() and get_path_pair() functions.
8
-
#' To see the benefits of using contraction hierarchies, see the package description : https://github.com/vlarmet/cppRouting.
8
+
#' To see the benefits of using contraction hierarchies, see the package description : \url{https://github.com/vlarmet/cppRouting/blob/master/README.md}.
if (length(to)< length(from)) res<-Phast3(test$rank[to_id+1],test$rank[from_id+1],test$rank[match(Graph$data$to,test$id)],test$rank[match(Graph$data$from,test$id)],Graph$data[,3],Graph$nbnode)
if (length(to)< length(from)) res<-Phast3(invrank[to_id+1],invrank[from_id+1],invrank[Graph$data$to+1],invrank[Graph$data$from+1],Graph$data[,3],Graph$nbnode)
Copy file name to clipboardExpand all lines: R/get_distance_pair.R
+12-5Lines changed: 12 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,23 @@
4
4
#' @param from A vector of one or more vertices from which distances are calculated (origin).
5
5
#' @param to A vector of one or more vertices (destination).
6
6
#' @param algorithm character. "Dijkstra" for uni-directional Dijkstra, "bi" for bi-directional Dijkstra, "A*" for A star unidirectional search or "NBA" for New bi-directional A star .Default to "Dijkstra"
7
-
#' @param constant numeric. Constant to maintain the heuristic function admissible in A* algorithm.
7
+
#' @param constant numeric. Constant to maintain the heuristic function admissible in A* and NBA algorithms.
8
8
#' Default to 1, when cost is expressed in the same unit than coordinates. See details
9
9
#' @param allcores Logical. If TRUE, all cores are used.
10
10
#' @return Vector of shortest distances.
11
11
#' @note 'from' and 'to' must be the same length.
12
-
#' @details If the input graph has been contracted by cpp_contract() function, the algorithm is a modified bidirectional search.
13
-
#' To perform A* and New Bidirectional A star, projected coordinates should be provided in the Graph object.
12
+
#' @details If graph is not contracted, the user has the choice between : \itemize{
13
+
#' \item unidirectional Dijkstra (Dijkstra)
14
+
#' \item A star (A*) : projected coordinates should be provided
15
+
#' \item bidirectional Dijkstra (bi)
16
+
#' \item New bi-directional A star (NBA) : projected coordinates should be provided
17
+
#' }
18
+
#'
19
+
#' If the input graph has been contracted by cpp_contract() function, the algorithm is a modified bidirectional search.
20
+
#'
14
21
#' In A* and New Bidirectional A star algorithms, euclidean distance is used as heuristic function.
15
-
#' To understand how A star algorithm work, see https://en.wikipedia.org/wiki/A*_search_algorithm.
16
-
#' To understand the importance of constant parameter, see the package description : https://github.com/vlarmet/cppRouting
22
+
#' To understand how A star algorithm work, see \url{https://en.wikipedia.org/wiki/A*_search_algorithm}.
23
+
#' To understand the importance of constant parameter, see the package description : \url{https://github.com/vlarmet/cppRouting/blob/master/README.md}
Copy file name to clipboardExpand all lines: R/get_path_pair.R
+12-5Lines changed: 12 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
#' Compute shortest path between origin and destination nodes.
2
2
#'
3
-
#' @param Graph An object generated by cppRouting::makegraph() function.
3
+
#' @param Graph An object generated by makegraph(), cpp_simplify() or cpp_contract() function.
4
4
#' @param from A vector of one or more vertices from which shortest paths are calculated (origin).
5
5
#' @param to A vector of one or more vertices (destination).
6
6
#' @param algorithm character. "Dijkstra" for uni-directional Dijkstra, "bi" for bi-directional Dijkstra, "A*" for A star unidirectional search or "NBA" for New bi-directional A star .Default to "Dijkstra"
@@ -10,11 +10,18 @@
10
10
#' Default to 1, when cost is expressed in the same unit than coordinates. See details
11
11
#' @return List or a data.frame containing shortest path nodes between from and to.
12
12
#' @note 'from' and 'to' must be the same length.
13
-
#' @details If the input graph has been contracted by cpp_contract() function, the algorithm is a modified bidirectional search.
14
-
#' To perform A* and New Bidirectional A star, projected coordinates should be provided in the Graph object.
13
+
#' @details If graph is not contracted, the user has the choice between : \itemize{
14
+
#' \item unidirectional Dijkstra (Dijkstra)
15
+
#' \item A star (A*) : projected coordinates should be provided
16
+
#' \item bidirectional Dijkstra (bi)
17
+
#' \item New bi-directional A star (NBA) : projected coordinates should be provided
18
+
#' }
19
+
#'
20
+
#' If the input graph has been contracted by cpp_contract() function, the algorithm is a modified bidirectional search.
21
+
#'
15
22
#' In A* and New Bidirectional A star algorithms, euclidean distance is used as heuristic function.
16
-
#' To understand how A star algorithm work, see https://en.wikipedia.org/wiki/A*_search_algorithm.
17
-
#' To understand the importance of constant parameter, see the package description : https://github.com/vlarmet/cppRouting
23
+
#' To understand how A star algorithm work, see \url{https://en.wikipedia.org/wiki/A*_search_algorithm}.
24
+
#' To understand the importance of constant parameter, see the package description : \url{https://github.com/vlarmet/cppRouting/blob/master/README.md}
0 commit comments