diff options
Diffstat (limited to 'chain/src/default.rs')
-rw-r--r-- | chain/src/default.rs | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/chain/src/default.rs b/chain/src/default.rs index 7de720f..23baa5f 100644 --- a/chain/src/default.rs +++ b/chain/src/default.rs @@ -20,10 +20,7 @@ use std::fmt::Display; use graph_macro::Graph; -use std::{ - borrow::Borrow, - collections::{HashMap as Map, HashSet, TryReserveError}, -}; +use std::collections::{HashMap as Map, HashSet, TryReserveError}; /// The errors related to taking derivatives by chain rule. #[non_exhaustive] @@ -404,7 +401,7 @@ impl Chain for DefaultChain { } fn atom(&self) -> &Self::Atom { - self.atom.borrow() + &self.atom } fn epsilon(&self) -> Result<bool, Self::Error> { @@ -805,6 +802,8 @@ impl Chain for DefaultChain { // The 1-th node is a dummy node that should be removed. assert_ne!(root, 1); + // let _ = self.forest.print_viz("help.gv"); + self.forest.remove_node(1)?; let root_degree = self.forest.degree(root)?; @@ -858,10 +857,7 @@ impl Chain for DefaultChain { } for clone in all_completed_clones { - nodes.push( - self.forest - .reduction(clone, pos, ter, self.atom.borrow(), true)?, - ); + nodes.push(self.forest.reduction(clone, pos, ter, &self.atom, true)?); } } else if root_label.clone_index().is_some() { panic!( @@ -887,10 +883,7 @@ impl Chain for DefaultChain { } } - nodes.push( - self.forest - .reduction(root, pos, ter, self.atom.borrow(), true)?, - ); + nodes.push(self.forest.reduction(root, pos, ter, &self.atom, true)?); } dbg!(&nodes); @@ -1080,7 +1073,7 @@ mod test_chain { for (pos, t) in input.iter().copied().enumerate().take(2) { chain.chain(t, pos, no_item)?; - chain.forest().print_viz(&format!("forest {pos}.gv"))?; + // chain.forest().print_viz(&format!("forest {pos}.gv"))?; dbg!(pos, t); } |