Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
oflatt committed Dec 13, 2023
1 parent 2af5621 commit 0b832c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/extract/faster_bottom_up.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ pub struct BottomUpExtractor;

impl Extractor for BottomUpExtractor {
fn extract(&self, egraph: &EGraph, _roots: &[ClassId]) -> ExtractionResult {
// 1. build map from class to parent nodes
let mut parents = IndexMap::<ClassId, Vec<NodeId>>::default();
let n2c = |nid: &NodeId| egraph.nid_to_cid(nid);
let mut analysis_pending = UniqueQueue::default();

for class in egraph.classes().values() {
parents.insert(class.id.clone(), Vec::new());
}

for class in egraph.classes().values() {
for node in &class.nodes {
for c in &egraph[node].children {
// compute parents of this enode
parents
.entry(n2c(c).clone())
.or_default()
.push(node.clone());
parents[n2c(c)].push(node.clone());
}

// also, start the analysis from leaves
// start the analysis from leaves
if egraph[node].is_leaf() {
analysis_pending.insert(node.clone());
}
Expand Down
2 changes: 0 additions & 2 deletions src/extract/greedy_dag_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ impl Extractor for FasterGreedyDagExtractor {
costs.insert(class_id.clone(), cost_set);
analysis_pending.extend(parents[class_id].iter().cloned());
}
} else {
analysis_pending.insert(node_id.clone());
}
}

Expand Down

0 comments on commit 0b832c3

Please sign in to comment.