All Projects → oooutlk → trees

oooutlk / trees

Licence: Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT
No description or website provided.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to trees

performant-array-to-tree
Converts an array of items with ids and parent ids to a nested tree in a performant O(n) way. Runs in browsers and Node.js.
Stars: ✭ 193 (+257.41%)
Mutual labels:  tree
jh-weapp-demo
微信小程序项目- 实现一些常用效果、封装通用组件和工具类
Stars: ✭ 60 (+11.11%)
Mutual labels:  tree
91-days-algorithm
91天学算法-Leetcode图解题解集合(JavaScript/C++/Python) Solutions and Explainations with Hand Drawings in Chinese(JavaScript/C++/Python)
Stars: ✭ 206 (+281.48%)
Mutual labels:  tree
vue2-data-tree
A tree that data is lazy loaded. Support dragging node, checking node, editing node's name and selecting node.
Stars: ✭ 41 (-24.07%)
Mutual labels:  tree
kirby3-bolt
Kirby 3 Plugin for a fast Page lookup even in big content trees
Stars: ✭ 24 (-55.56%)
Mutual labels:  tree
ngx-tree
A derived version of angular-tree-component without mobx, better performance.
Stars: ✭ 13 (-75.93%)
Mutual labels:  tree
comment tree
Render comment tree like facebook comment - reply
Stars: ✭ 37 (-31.48%)
Mutual labels:  tree
RangeTree
A generic interval tree implementation in C#
Stars: ✭ 144 (+166.67%)
Mutual labels:  tree
rust-lapper
Rust implementation of a fast, easy, interval tree library nim-lapper
Stars: ✭ 39 (-27.78%)
Mutual labels:  tree
qrrs
CLI QR code generator and reader written in rust
Stars: ✭ 29 (-46.3%)
Mutual labels:  rust-crate
js-symbol-tree
Turn any collection of objects into its own efficient tree or linked list using Symbol
Stars: ✭ 86 (+59.26%)
Mutual labels:  tree
5itv
familytree家谱宗谱族谱 刘三才族裔刘氏族谱网源码
Stars: ✭ 23 (-57.41%)
Mutual labels:  tree
webbrowser-rs
Rust library to open URLs in the web browsers available on a platform
Stars: ✭ 150 (+177.78%)
Mutual labels:  rust-crate
react-tree
Hierarchical tree component for React in Typescript
Stars: ✭ 174 (+222.22%)
Mutual labels:  tree
pyrubrum
An intuitive framework for creating Telegram bots.
Stars: ✭ 33 (-38.89%)
Mutual labels:  tree
react-org-tree
😃 a simple organization tree component based on react
Stars: ✭ 72 (+33.33%)
Mutual labels:  tree
filterCSV
Tools to manipulate CSV files in a format suitable for importing into various mindmapping programs - such as iThoughts, Freemind, and MindNode.
Stars: ✭ 29 (-46.3%)
Mutual labels:  tree
AdvancedHTMLParser
Fast Indexed python HTML parser which builds a DOM node tree, providing common getElementsBy* functions for scraping, testing, modification, and formatting. Also XPath.
Stars: ✭ 90 (+66.67%)
Mutual labels:  tree
whoami
Rust crate to get the current user and environment.
Stars: ✭ 68 (+25.93%)
Mutual labels:  rust-crate
bactmap
A mapping-based pipeline for creating a phylogeny from bacterial whole genome sequences
Stars: ✭ 36 (-33.33%)
Mutual labels:  tree

This project provides trees data structure serving for general purpose.

Quickstart

Impatient readers can start with the notations.

Features

  1. Step-by-step creating, reading, updating, deleting and iterating nodes with assocated data items.

  2. Compact notations to express trees: -,/ encoded or tuple encoded trees.

  3. Depth first search cursor.

  4. Breadth first search iterators.

  5. Trees can be built by stages, with nodes stored scatteredly among memory.

  6. Trees can be built once through, with nodes stored contiguously.

  7. Support exclusive ownership with static borrow check.

  8. Support shared ownership with dynamic borrow check.

Examples

  • notation of a literal tree

    use trees::tr;
    
    let scattered_tree = tr(0) /( tr(1)/tr(2)/tr(3) ) /( tr(4)/tr(5)/tr(6) );
    let piled_tree = trees::Tree::from(( 0, (1,2,3), (4,5,6) ));

    They both encode a tree drawn as follows:

    .............
    .     0     .
    .   /   \   .
    .  1     4  .
    . / \   / \ .
    .2   3 5   6.
    .............
    
  • use tree notation to reduce syntax noise, quoted from crate reflection_derive, version 0.1.1:

    quote! {
        #(
            -( ::reflection::variant( stringify!( #vnames ))
                /(
                    #(
                        -( ::reflection::field(
                                #fnames,
                                <#ftypes1 as ::reflection::Reflection>::ty(),
                                <#ftypes2 as ::reflection::Reflection>::name(),
                                Some( <#ftypes3 as ::reflection::Reflection>::members )))
                    )*
                )
            )
        )*
    }

    The starting of tree operations are denoted by -( and /( which are humble enough to let the reader focusing on the data part.

  • use iterators if the tree travesal is a "driving wheel"( you can iterate over the tree on your own ).

    use trees::{Node, tr};
    use std::fmt::Display;
    
    let tree = tr(0)
        /( tr(1) /tr(2)/tr(3) )
        /( tr(4) /tr(5)/tr(6) );
    
    fn tree_to_string<T:Display>( node: &Node<T> ) -> String {
        if node.has_no_child() {
            node.data.to_string()
        } else {
            format!( "{}( {})", node.data,
                node.iter().fold( String::new(),
                    |s,c| s + &tree_to_string(c) + &" " ))
        }
    }
    
    assert_eq!( tree_to_string( &tree ), "0( 1( 2 3 ) 4( 5 6 ) )" );
  • use TreeWalk when the tree travesal is a "driven wheel"( driven by other library ). Quoted from crate tsv, version 0.1.0:

        fn next_value_seed<V:DeserializeSeed<'de>>( &mut self, seed: V ) -> Result<V::Value> {
            let result = self.next_element_in_row( seed )?;
            self.de.next_column();
            self.de.row += 1;
            self.de.pop_stack(); // finish key-value pair
            self.de.next_column();
            self.de.columns.revisit();
            Ok( result )
        }

    The serde library is driving on the schema tree when (de)serializing variables. Use TreeWalk methods such as next_column and revisit to follow the step.

License

Under Apache License 2.0 or MIT License, at your will.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].