Struct EulerTourTree

Source
pub struct EulerTourTree<M> { /* private fields */ }
Expand description

Euler tour tree

Implementations§

Source§

impl<M: Monoid + Clone> EulerTourTree<M>

Source

pub fn new(n: usize) -> Self

n個の頂点のみからなる森を構築する。

Source

pub fn reroot(&mut self, r: usize)

頂点rをそれの属する木の根にする。

Source

pub fn is_same_tree(&self, i: usize, j: usize) -> bool

2つの頂点が同一の木に属するかどうかを判定する。

異なる木にそれぞれ属する2頂点間に辺を張る。

Source

pub fn cut(&mut self, i: usize, j: usize) -> Result<(), &'static str>

2頂点間を張る辺を削除する。

Source

pub fn set(&mut self, i: usize, value: M)

頂点iの値をvalueに設定する。

Source

pub fn update(&mut self, i: usize, value: M)

頂点iの値をモノイドの演算と値valueで更新する。

Source

pub fn subtree_sum(&mut self, v: usize, p: usize) -> Result<M, &'static str>

頂点pを親とする頂点vについて、vを根とする部分木の値を集積して返す。

Auto Trait Implementations§

§

impl<M> Freeze for EulerTourTree<M>

§

impl<M> RefUnwindSafe for EulerTourTree<M>
where M: RefUnwindSafe,

§

impl<M> !Send for EulerTourTree<M>

§

impl<M> !Sync for EulerTourTree<M>

§

impl<M> Unpin for EulerTourTree<M>

§

impl<M> UnwindSafe for EulerTourTree<M>
where M: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.