Giter Club home page Giter Club logo

flat-tree-rs's Introduction

flat-tree

Rust version of flat-tree. A series of functions to map a binary tree to a list

build status

Usage

extern crate flat_tree;

let parent = flat_tree::parent(0);
println!("parent of 0 is {}", parent);

API

index(depth: u64, offset: u64) -> u64

Returns the flat-tree of the tree node at the specified depth and offset

depth(node: u64) -> u64

Returns the depth of a node

offset(node: u64) -> u64

Returns the offset of a node

parent(node: u64) -> u64

Returns the parent of a node

sibling(node: u64) -> u64

Returns the sibling of a node

uncle(node: u64) -> u64

Returns the parent's sibling of a node

children(node: u64) -> (u64, u64)

Returns both children of a node.

left_child(node: u64) -> u64

Returns only the left child of a node

right_child(node: u64) -> u64

Returns only the right child of a node

right_span(node: u64) -> u64

Returns the right most node in the tree that i spans

left_span(node: u64) -> u64

Returns the left most node in the tree that i spans

spans(node: u64) -> (u64, u64)

Returns the left and right most nodes in the tree that i spans

count(node: u64) -> u64

Returns how many nodes are in the tree that the node spans

full_roots(node: u64) -> Vec<u64>

Returns all the previous fully rooted trees before the node

License

MIT

flat-tree-rs's People

Contributors

mafintosh avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.