barnes 0.1.2

A multithreaded Barnes Hut Algorithm implementation.
Documentation

Barnes-Hut tree in Rust

Based on The Barnes-Hut Algorithm by Tom Ventimiglia & Kevin Wayne. "A quad-tree is similar to a binary tree, except that each node has 4 children"

Made to learn Rust

My friend Tristan Brismontier was building a (more advance) Barnes-Hut in C# using Unity. It looks like a nice project for learning Rust. Also, an interesting candidate for building an Anomaly Detection Service

How to use

Add barnes dependency in Cargo.toml:

[dependencies]

barnes = "0.1.0"
extern crate barnes;
use data::{Point, Square, Region};
use tree::Tree;

fn create_points() -> Vec<Point> {
	vec![
		Point::new(13, 62, "A"),
		Point::new(45, 65, "C"),
		Point::new(54, 72, "B"),
		Point::new(62, 57, "D"),
		Point::new(38, 38, "E"),
		Point::new(11, 5, "F"),
		Point::new(32, 11, "G"),
		Point::new(52, 8, "H"),
		]
}

fn main() {
	let mut square = Square::new(0, 0, 80);
	square = Tree.compute_root(square, create_points());
	
	println!("{:?}", square);
}

This code use 8 points: barnes-hut quadrant

It produce this quadtree: barnes-hut tree

Performance

in x: number of point to place in the tree in y: time used in second

perf1

28 second to insert 40.000.000 point in the Barnes-Hut tree. (on MacBook Pro 8 core)

Contact

Developed by Martin Magakian dev.martin.magakian@gmail.com by Anomaly Detection

License

MIT License (MIT)