From b26fefaf2379f491a11fbecb25c4f13e7ff17765 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Fri, 2 Jul 2021 21:53:39 -0700 Subject: [PATCH] Clarify that we find the shortest route --- src/dijkstra.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dijkstra.rs b/src/dijkstra.rs index 571dd5a4e..d4ef34088 100644 --- a/src/dijkstra.rs +++ b/src/dijkstra.rs @@ -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]);