Struct enso_data::dependency_graph::DependencyGraph[][src]

pub struct DependencyGraph<T> { /* fields omitted */ }
Expand description

Dependency graph keeping track of Nodes 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]

pub fn new() -> Self[src]

Constructor.

pub fn insert_dependency(&mut self, first: T, second: T) -> bool[src]

Insert a new dependency to the graph. Returns true if the insertion was successful (the dependency was not present already), or false otherwise.

pub fn remove_dependency(&mut self, first: T, second: T) -> bool[src]

Remove a dependency from the graph. Returns true if the dependency was found, or false otherwise.

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]

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]

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]

Just like [kept_only], but the provided slice must be sorted.

pub fn topo_sort(&self, keys: &[T]) -> Vec<T>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[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>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[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>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Just like [topo_sort], but the provided slice must be sorted.

pub fn into_unchecked_topo_sort(self, sorted_keys: Vec<T>) -> Vec<T>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Just like [unchecked_topo_sort], bbut consumes the current dependency graph instead of cloning it.

Trait Implementations

impl<T: Clone> Clone for 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]

Performs copy-assignment from source. Read more

impl<T> Debug for DependencyGraph<T> where
    T: Debug + Eq + Hash
[src]

fn fmt(&self, __f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T> Default for DependencyGraph<T> where
    T: Eq + Hash + Ord
[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl<T: Ord> Extend<(T, Node<T>)> for DependencyGraph<T>[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]

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

fn extend_reserve(&mut self, additional: usize)[src]

🔬 This is a nightly-only experimental API. (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]

type Item = (&'a T, &'a Node<T>)

The type of the elements being iterated over.

type IntoIter = Iter<'a, T, Node<T>>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Iter<'a, T, Node<T>>[src]

Creates an iterator from a value. Read more

impl<T> IntoIterator for DependencyGraph<T>[src]

type Item = (T, Node<T>)

The type of the elements being iterated over.

type IntoIter = IntoIter<T, Node<T>>

Which kind of iterator are we turning this into?

fn into_iter(self) -> IntoIter<T, Node<T>>[src]

Creates an iterator from a value. Read more

Auto Trait Implementations

impl<T> RefUnwindSafe for DependencyGraph<T> where
    T: RefUnwindSafe

impl<T> Send for DependencyGraph<T> where
    T: Send

impl<T> Sync for DependencyGraph<T> where
    T: Sync

impl<T> Unpin for DependencyGraph<T>

impl<T> UnwindSafe for DependencyGraph<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> HasRefValue for T where
    T: ?Sized
[src]

type RefValue = T

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> PhantomConversions for T[src]

fn phantom_into<P>() -> P where
    Self: PhantomInto<P>, 
[src]

fn phantom_from<P>() -> Self where
    P: PhantomInto<Self>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

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

Checks if self is actually part of its subset T (and can be converted to it).

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

The inclusion map: converts self to the equivalent element of its superset.

impl<T> ToImpl for T[src]

fn to<P>(self) -> P where
    Self: Into<P>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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]

🔬 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> ToRef<T> for T where
    T: ?Sized
[src]

pub fn to_ref(&self) -> &T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> TypeDisplay for T[src]

pub default fn type_display() -> String[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V