Arena based tree 🌲 structure by using indices instead of reference counted pointers
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples Add simple example and update readme Sep 30, 2018
src Add basic node removal appraoch (#16) Sep 30, 2018
tests Add basic node removal appraoch (#16) Sep 30, 2018
.travis.yml Make rayon optional (#13) Jul 8, 2018
LICENSE Update LICENSE (#17) Oct 3, 2018
appveyor.yml Make rayon optional (#13) Jul 8, 2018


Build Status Build status Coverage Status doc indextree License MIT

Arena based tree structure with multithreading support

This arena tree structure is using just a single Vec and numerical identifiers (indices in the vector) instead of reference counted pointers. This means there is no RefCell and mutability is handled in a way much more idiomatic to Rust through unique (&mut) access to the arena. The tree can be sent or shared across threads like a Vec. This enables general multiprocessing support like parallel tree traversals.

Example usage

use indextree::Arena;

// Create a new arena
let arena = &mut Arena::new();

// Add some new nodes to the arena
let a = arena.new_node(1);
let b = arena.new_node(2);

// Append a to b
assert!(a.append(b, arena).is_ok());
assert_eq!(b.ancestors(arena).into_iter().count(), 2);