pub struct Node(/* private fields */);Expand description
A node or gate in a boolean circuit.
The inputs of the circuit are variables identified by their name. Other types of nodes are constant nodes or operations that have predecessors.
The clone operation only performs a shallow clone and thus allows sharing of nodes.
Implementations§
Source§impl Node
impl Node
Sourcepub fn id(&self) -> usize
pub fn id(&self) -> usize
Returns an identifier for the node which is unique in the circuit but not stable across program reloads.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Node>
pub fn iter(&self) -> impl Iterator<Item = &Node>
Creates an iterator over the graph (the node itself and all its predecessors) that returns each node exactly once.
Sourcepub fn post_visit_iter(&self) -> impl Iterator<Item = &Node>
pub fn post_visit_iter(&self) -> impl Iterator<Item = &Node>
Creates an iterator over the graph (the node itself and all its predecessors) with post-visit order, visiting each node exactly once. This means that the predecessors of each node are always visited before the node itself.
Sourcepub fn to_string_as_tree(&self) -> String
pub fn to_string_as_tree(&self) -> String
Turns the node and its predecessors into a string representation, repeating shared nodes.
Sourcepub fn try_to_constant(&self) -> Option<bool>
pub fn try_to_constant(&self) -> Option<bool>
Returns the value of the node if it is a constant input node.
Sourcepub fn gate_count(&self) -> (usize, usize)
pub fn gate_count(&self) -> (usize, usize)
Returns the number of variables and gates (nodes not counting variables or constants) in the circuit.
This depends on how the circuit was constructed, i.e. it does not deduplicate sub-circuits, but it does deduplicate variables with the same name.
Trait Implementations§
Source§impl<'a> IntoIterator for &'a Node
impl<'a> IntoIterator for &'a Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl !Send for Node
impl !Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more