Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seniverse/vptree
An Erlang implementation of vantage point tree.
https://github.com/seniverse/vptree
erlang-library vantage-point-tree
Last synced: 11 days ago
JSON representation
An Erlang implementation of vantage point tree.
- Host: GitHub
- URL: https://github.com/seniverse/vptree
- Owner: seniverse
- License: apache-2.0
- Created: 2019-07-12T10:56:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-12T11:05:16.000Z (over 5 years ago)
- Last Synced: 2024-09-17T20:07:33.163Z (2 months ago)
- Topics: erlang-library, vantage-point-tree
- Language: Erlang
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## vptree
[![Build Status](https://travis-ci.org/seniverse/vptree.svg?branch=master)](https://travis-ci.org/seniverse/vptree)
[![Coverage Status](https://coveralls.io/repos/github/seniverse/vptree/badge.svg?branch=master)](https://coveralls.io/github/seniverse/vptree?branch=master)
[![hex.pm version](https://img.shields.io/hexpm/v/vptree.svg)](https://hex.pm/packages/vptree)
[![hex.pm downloads](https://img.shields.io/hexpm/dt/vptree.svg)](https://hex.pm/packages/vptree)
![hex.pm license](https://img.shields.io/hexpm/l/vptree.svg)
![GitHub top language](https://img.shields.io/github/languages/top/seniverse/vptree.svg)An Erlang implementation of vantage point tree.
### Usage
Define a distance function
```
1> Distance = fun({X1,Y1},{X2,Y2}) -> X = X2-X1, Y = Y2-Y1, math:sqrt(X*X+Y*Y) end.
```Create vantage point tree from a list of points
```
2> Tree = vptree:from_list(Distance, [{{0.0, 0.0}, a}, {{1.0, 1.0}, b}]).
```Find nearest point within a given distance
```
3> vptree:search(Distance, {0.2,0.2}, 100.0, not_found, Tree).
a
4> vptree:search(Distance, {0.2,0.2}, 0.1, not_found, Tree).
not_found
```### Installation
add `vptree` dependency to your project's `rebar.config`
```
{deps, [vptree]}.
```### License
vptree is released under Apache 2 License. Check [LICENSE](./LICENSE) file for more information.