Clarify that we find the shortest route

pull/25/head
Wilfred Hughes 2021-07-02 21:53:39 +07:00
parent f4c88e95e1
commit b26fefaf23
1 changed files with 4 additions and 4 deletions

@ -110,7 +110,7 @@ impl Edge {
}
}
fn find_route<'a>(start: Vertex<'a>) -> Vec<(Edge, Vertex<'a>)> {
fn shortest_path<'a>(start: Vertex<'a>) -> Vec<(Edge, Vertex<'a>)> {
let mut heap = BinaryHeap::new();
heap.push(OrdVertex { v: start.clone() });
@ -312,7 +312,7 @@ pub fn toplevel_list<'a>(
pub fn mark_node<'a>(lhs: &'a Node<'a>, rhs: &'a Node<'a>) {
let start = Vertex::new(lhs, rhs);
let route = find_route(start);
let route = shortest_path(start);
mark_route(&route);
}
@ -394,7 +394,7 @@ mod tests {
});
let start = Vertex::new(lhs, rhs);
let route = find_route(start);
let route = shortest_path(start);
let actions = route.iter().map(|(action, _)| *action).collect_vec();
assert_eq!(actions, vec![StartNode, UnchangedNode]);
@ -425,7 +425,7 @@ mod tests {
set_next(rhs);
let start = Vertex::new(lhs, rhs);
let route = find_route(start);
let route = shortest_path(start);
let actions = route.iter().map(|(action, _)| *action).collect_vec();
assert_eq!(actions, vec![StartNode, UnchangedDelimiter, NovelAtomLHS]);