pub struct Lattice { /* private fields */ }Expand description
A directed acyclic lattice with one start node and one end node.
Nodes are addressed by zero-based indices. Arcs must move from lower to higher node indices so distance algorithms can process the lattice in topological order.
Implementations§
Source§impl Lattice
impl Lattice
Sourcepub fn from_edges(
node_count: usize,
start: usize,
end: usize,
arcs: Vec<Arc>,
) -> Result<Lattice, LatticeError>
pub fn from_edges( node_count: usize, start: usize, end: usize, arcs: Vec<Arc>, ) -> Result<Lattice, LatticeError>
Builds a lattice from explicit nodes and arcs.
start and end must be valid node indices with start <= end.
Every arc must reference valid nodes and satisfy src < dst.
Sourcepub fn from_paths<I, S>(paths: I) -> Lattice
pub fn from_paths<I, S>(paths: I) -> Lattice
Builds a lattice from UTF-8 string paths.
§Panics
Panics when paths is empty or when empty and non-empty paths are
mixed. Use Lattice::try_from_paths to handle those cases as input
errors.
Sourcepub fn try_from_paths<I, S>(paths: I) -> Result<Lattice, LatticeError>
pub fn try_from_paths<I, S>(paths: I) -> Result<Lattice, LatticeError>
Builds a lattice from UTF-8 string paths.
Sourcepub fn from_symbol_paths<I, P>(paths: I) -> Lattice
pub fn from_symbol_paths<I, P>(paths: I) -> Lattice
Builds a lattice from symbol paths.
§Panics
Panics when paths is empty or when empty and non-empty paths are
mixed. Use Lattice::try_from_symbol_paths to handle those cases as
input errors.
Sourcepub fn try_from_symbol_paths<I, P>(paths: I) -> Result<Lattice, LatticeError>
pub fn try_from_symbol_paths<I, P>(paths: I) -> Result<Lattice, LatticeError>
Builds a lattice from symbol paths.
Sourcepub fn from_symbol_paths_compact<I, P>(paths: I) -> Lattice
pub fn from_symbol_paths_compact<I, P>(paths: I) -> Lattice
Builds a compact lattice from symbol paths by sharing common suffixes.
§Panics
Panics when paths is empty or when empty and non-empty paths are
mixed. Use Lattice::try_from_symbol_paths_compact to handle those
cases as input errors.
Sourcepub fn try_from_symbol_paths_compact<I, P>(
paths: I,
) -> Result<Lattice, LatticeError>
pub fn try_from_symbol_paths_compact<I, P>( paths: I, ) -> Result<Lattice, LatticeError>
Builds a compact lattice from symbol paths by sharing common suffixes.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the number of nodes in the lattice.
Sourcepub fn try_incoming_arcs(
&self,
node: usize,
) -> Option<impl Iterator<Item = &Arc>>
pub fn try_incoming_arcs( &self, node: usize, ) -> Option<impl Iterator<Item = &Arc>>
Returns incoming arcs for node, or None when the node index is out
of range.
Sourcepub fn incoming_arcs(&self, node: usize) -> impl Iterator<Item = &Arc>
pub fn incoming_arcs(&self, node: usize) -> impl Iterator<Item = &Arc>
Trait Implementations§
impl Eq for Lattice
impl StructuralPartialEq for Lattice
Auto Trait Implementations§
impl Freeze for Lattice
impl RefUnwindSafe for Lattice
impl Send for Lattice
impl Sync for Lattice
impl Unpin for Lattice
impl UnsafeUnpin for Lattice
impl UnwindSafe for Lattice
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.