[−][src]Struct louds_rs::louds::Louds
LOUDS (Level-Order Unary Degree Sequence).
This class can handle tree structure of virtually arbitrary number of nodes.
In fact, N (number of nodes in the tree) is designed to be limited to: N < 2^64 / 2, while each node is represented in 2bits in average.
It should be enough for almost all usecases since a binary data of length of 2^63 consumes 2^20 = 1,048,576 TB (terabytes), which is hard to handle by state-of-the-art computer architecture.
Methods
impl Louds
[src]
pub fn node_num_to_index(&self, node_num: LoudsNodeNum) -> LoudsIndex
[src]
Panics
node_num
does not exist in this LOUDS.
pub fn index_to_node_num(&self, index: LoudsIndex) -> LoudsNodeNum
[src]
Panics
index
does not point to any node in this LOUDS.
pub fn child_to_parent(&self, index: LoudsIndex) -> LoudsNodeNum
[src]
Panics
index
does not point to any node in this LOUDS.index == 0
: (node#1 is root and doesn't have parent)
pub fn parent_to_children(&self, node_num: LoudsNodeNum) -> Vec<LoudsIndex>
[src]
Panics
node_num
does not exist in this LOUDS.
Trait Implementations
impl<'_> From<&'_ str> for Louds
[src]
fn from(s: &str) -> Self
[src]
Prepares for building Louds from LBS (LOUDS Bit vector).
It takes O(log s
) time for validation.
Panics
If s
does not represent a LOUDS tree. s
must satisfy the following condition as LBS.
- Starts from "10"
- In the range of [0, i] for any i (< length of LBS);
- the number of '0' <= the number of '1' + 1, because:
- Each node, including virtual root (node num = 0), has one '0'.
- Each node is derived from one '1'.
- the number of '0' <= the number of '1' + 1, because:
- In the range of [0, length of LBS);
- the number of '0' == the number of '1' + 1
impl<'_> From<&'_ [bool]> for Louds
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,