From b9c1228f62341c5ec3f7eae9093b519e1caba3f3 Mon Sep 17 00:00:00 2001 From: Trevor Hansen Date: Sun, 31 Dec 2023 11:37:43 +1100 Subject: [PATCH] fix faster-greedy-dag extractor. --- src/extract/faster_greedy_dag.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/extract/faster_greedy_dag.rs b/src/extract/faster_greedy_dag.rs index 289ca16..1098b78 100644 --- a/src/extract/faster_greedy_dag.rs +++ b/src/extract/faster_greedy_dag.rs @@ -22,11 +22,11 @@ impl FasterGreedyDagExtractor { best_cost: Cost, ) -> CostSet { let node = &egraph[&node_id]; + let cid = egraph.nid_to_cid(&node_id); - // No children -> easy. if node.children.is_empty() { return CostSet { - costs: Default::default(), + costs: HashMap::from([(cid.clone(), node.cost)]), total: node.cost, choice: node_id.clone(), }; @@ -41,8 +41,6 @@ impl FasterGreedyDagExtractor { childrens_classes.sort(); childrens_classes.dedup(); - let cid = egraph.nid_to_cid(&node_id); - let first_cost = costs.get(&childrens_classes[0]).unwrap(); if childrens_classes.contains(cid)