diff --git a/img/tree.png b/img/tree.png new file mode 100644 index 0000000..52c8df3 Binary files /dev/null and b/img/tree.png differ diff --git a/license b/license new file mode 100644 index 0000000..64007ea --- /dev/null +++ b/license @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Brandon Semilla + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/package.json b/package.json new file mode 100644 index 0000000..5b26659 --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "name": "emst", + "version": "0.0.0", + "description": "generates a euclidean minimum spanning tree from a given graph", + "author": "semibran (Brandon Semilla)", + "repository": "semibran/emst", + "license": "MIT", + "main": "lib/emst.js", + "keywords": [] +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..9fb6a46 --- /dev/null +++ b/readme.md @@ -0,0 +1,15 @@ +# emst +> generates a euclidean minimum spanning tree from a given graph + +![tree](img/tree.png) + +This module exposes the `span` function, which uses [Prim's algorithm] to generate a [minimum spanning tree] based on [Euclidean distance] from a given graph. + +## usage + +### `span(graph) -> tree` +Converts a `graph` with the fields `nodes` (a list of `[ x, y ]` pairs) and `edges` (a list of undirected node index pairs) to a minimum spanning tree. + +[Prim's algorithm]: https://en.wikipedia.org/wiki/Prim%27s_algorithm +[Minimum spanning tree]: https://en.wikipedia.org/wiki/Minimum_spanning_tree +[Euclidean distance]: https://en.wikipedia.org/wiki/Euclidean_distance