Skip to content

Commit

Permalink
implementing BDD::compose
Browse files Browse the repository at this point in the history
  • Loading branch information
shnarazk committed Feb 4, 2024
1 parent caa3cf5 commit d75f9af
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/bdd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,32 +199,15 @@ impl ReducedDecisionDiagram for BDD<Node> {
fn compose(&self, other: &Self, var_index: usize) -> Self {
let v1 = self.graph.clone();
let v2 = other.graph.clone();
let mut node: HashMap<usize, Node> = HashMap::new();
node.insert(0, Node::new_constant(false));
node.insert(1, Node::new_constant(true));
let mut index: HashMap<Node, usize> = HashMap::new();
for (i, n) in self
.graph
.all_nodes()
.iter()
.chain(other.graph.all_nodes().iter())
.enumerate()
{
node.insert(i + 2, (*n).clone());
if let Some(b) = n.is_constant() {
index.insert((*n).clone(), b as usize);
} else {
index.insert((*n).clone(), i + 2);
}
}
let mut indexer = Node::build_indexer(&[v1.clone(), v2.clone()]);
let mut links: HashMap<(usize, usize, usize), Node> = HashMap::new();
let mut values: HashMap<Node, bool> = HashMap::new();
BDD::new_from(compose_aux(
&v1,
&v1,
&v2,
var_index,
&mut (index, node),
&mut indexer,
&mut links,
&mut values,
))
Expand Down

0 comments on commit d75f9af

Please sign in to comment.