summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml1
-rw-r--r--README.md30
2 files changed, 31 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index ebdf330..418514a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,6 +4,7 @@ version = "0.1.0"
authors = ["Tavian Barnes <tavianator@tavianator.com>"]
edition = "2018"
description = "A principled API for nearest neighbor search in both metric and non-metric spaces"
+readme = "README.md"
repository = "https://github.com/tavianator/acap"
license = "MIT"
keywords = ["ann", "knn", "nearest-neighbors"]
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2407ebc
--- /dev/null
+++ b/README.md
@@ -0,0 +1,30 @@
+`acap`
+======
+
+[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/tavianator/knn/blob/master/LICENSE)
+[![Build Status](https://travis-ci.com/tavianator/acap.svg?branch=master)](https://travis-ci.com/tavianator/acap)
+
+As Close As Possible — [nearest neighbor search] in Rust.
+
+[nearest neighbor search]: https://en.wikipedia.org/wiki/Nearest_neighbor_search
+
+
+Example
+-------
+
+```rust
+use acap::euclid::Euclidean;
+use acap::vp::VpTree;
+use acap::NearestNeighbors;
+
+let tree = VpTree::balanced(vec![
+ Euclidean([3, 4]),
+ Euclidean([5, 12]),
+ Euclidean([8, 15]),
+ Euclidean([7, 24]),
+]);
+
+let nearest = tree.nearest(&[7, 7]).unwrap();
+assert_eq!(nearest.item, &Euclidean([3, 4]));
+assert_eq!(nearest.distance, 5);
+```