[][src]Struct sprs::linalg::etree::Parents

pub struct Parents<S> where
    S: Deref<Target = [Parent]>, 
{ /* fields omitted */ }

Store an etree as the parent information of each node. This reflects the fact that etrees can in fact have multiple roots.

Methods

impl<S: Deref<Target = [Parent]>> Parents<S>[src]

pub fn get_parent(&self, node: usize) -> Option<usize>[src]

Get the parent of a node. Returns None if the node is a root.

Panics

  • if node is out of bounds

pub fn is_root(&self, node: usize) -> bool[src]

Test whether a node is a root.

Panics

  • if node is out of bounds

pub fn nb_nodes(&self) -> usize[src]

The number of nodes in this tree.

pub fn view(&self) -> ParentsView[src]

Get a view of this object

impl<S: DerefMut<Target = [Parent]>> Parents<S>[src]

pub fn set_parent(&mut self, node: usize, parent: usize)[src]

Set the parent of a node.

Panics

  • if node is out of bounds
  • if parent is out of bounds

pub fn set_root(&mut self, node: usize)[src]

Set a node as a root.

Panics

  • if node is out of bounds

pub fn uproot(&mut self, node: usize, parent: usize)[src]

Give a parent to a root of the tree. No-op if the node was not a parent.

Panics

if either node or parent is out of bounds

pub fn view_mut(&mut self) -> ParentsViewMut[src]

impl Parents<Vec<Parent>>[src]

pub fn new(nb_nodes: usize) -> ParentsOwned[src]

Create a new tree with all nodes set as root

Trait Implementations

impl<S: Clone> Clone for Parents<S> where
    S: Deref<Target = [Parent]>, 
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<S: Debug> Debug for Parents<S> where
    S: Deref<Target = [Parent]>, 
[src]

Auto Trait Implementations

impl<S> Send for Parents<S> where
    S: Send

impl<S> Sync for Parents<S> where
    S: Sync

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

The type returned in the event of a conversion error.

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

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>, 
[src]