Struct enso_data::dependency_graph::DependencyGraph [−][src]
pub struct DependencyGraph<T> { /* fields omitted */ }
Expand description
Dependency graph keeping track of Node
s and their dependencies.
The primary use case of this graph is topological sorting of dependencies. Please note that this graph implementation is not DAG, it can contain cycles. In case a cycle occurs it will be automatically broken on the lowest node id.
Implementations
impl<T: Clone + Eq + Hash + Ord> DependencyGraph<T>
[src]
impl<T: Clone + Eq + Hash + Ord> DependencyGraph<T>
[src]pub fn insert_dependency(&mut self, first: T, second: T) -> bool
[src]
pub fn insert_dependency(&mut self, first: T, second: T) -> bool
[src]pub fn remove_dependency(&mut self, first: T, second: T) -> bool
[src]
pub fn remove_dependency(&mut self, first: T, second: T) -> bool
[src]pub fn keep_only(&mut self, keys: &[T])
[src]
pub fn keep_only(&mut self, keys: &[T])
[src]Removes all (incoming and outgoing) dependencies from nodes whose indexes do not belong to the provided slice.
pub fn kept_only(self, keys: &[T]) -> Self
[src]
pub fn kept_only(self, keys: &[T]) -> Self
[src]Removes all (incoming and outgoing) dependencies from nodes whose indexes do not belong to the provided slice.
pub fn unchecked_keep_only(&mut self, sorted_keys: impl IntoIterator<Item = T>)
[src]
pub fn unchecked_keep_only(&mut self, sorted_keys: impl IntoIterator<Item = T>)
[src]Just like [keep_only
], but the provided slice must be sorted.
pub fn unchecked_kept_only(
self,
sorted_keys: impl IntoIterator<Item = T>
) -> Self
[src]
pub fn unchecked_kept_only(
self,
sorted_keys: impl IntoIterator<Item = T>
) -> Self
[src]Just like [kept_only
], but the provided slice must be sorted.
pub fn topo_sort(&self, keys: &[T]) -> Vec<T>ⓘ
[src]
pub fn topo_sort(&self, keys: &[T]) -> Vec<T>ⓘ
[src]Sorts the provided indexes in topological order based on the rules recorded in the graph. In case the graph is not a DAG, it will still be sorted by breaking cycles on elements with the smallest index.
pub fn into_topo_sort(self, keys: &[T]) -> Vec<T>ⓘ
[src]
pub fn into_topo_sort(self, keys: &[T]) -> Vec<T>ⓘ
[src]Just like [topo_sort
], but consumes the current dependency graph instead of cloning it.
pub fn unchecked_topo_sort(&self, sorted_keys: Vec<T>) -> Vec<T>ⓘ
[src]
pub fn unchecked_topo_sort(&self, sorted_keys: Vec<T>) -> Vec<T>ⓘ
[src]Just like [topo_sort
], but the provided slice must be sorted.
Trait Implementations
impl<T: Clone> Clone for DependencyGraph<T>
[src]
impl<T: Clone> Clone for DependencyGraph<T>
[src]fn clone(&self) -> DependencyGraph<T>
[src]
fn clone(&self) -> DependencyGraph<T>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<T: Ord> Extend<(T, Node<T>)> for DependencyGraph<T>
[src]
impl<T: Ord> Extend<(T, Node<T>)> for DependencyGraph<T>
[src]fn extend<I: IntoIterator<Item = (T, Node<T>)>>(&mut self, iter: I)
[src]
fn extend<I: IntoIterator<Item = (T, Node<T>)>>(&mut self, iter: I)
[src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, item: A)
[src]
fn extend_one(&mut self, item: A)
[src]extend_one
)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl<'a, T> IntoIterator for &'a DependencyGraph<T>
[src]
impl<'a, T> IntoIterator for &'a DependencyGraph<T>
[src]Auto Trait Implementations
impl<T> RefUnwindSafe for DependencyGraph<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for DependencyGraph<T> where
T: Send,
T: Send,
impl<T> Sync for DependencyGraph<T> where
T: Sync,
T: Sync,
impl<T> Unpin for DependencyGraph<T>
impl<T> UnwindSafe for DependencyGraph<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> HasRefValue for T where
T: ?Sized,
[src]
impl<T> HasRefValue for T where
T: ?Sized,
[src]type RefValue = T
impl<T> PhantomConversions for T
[src]
impl<T> PhantomConversions for T
[src]fn phantom_into<P>() -> P where
Self: PhantomInto<P>,
[src]
Self: PhantomInto<P>,
fn phantom_from<P>() -> Self where
P: PhantomInto<Self>,
[src]
P: PhantomInto<Self>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> TypeDisplay for T
[src]
impl<T> TypeDisplay for T
[src]pub default fn type_display() -> String
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,