An open API service indexing awesome lists of open source software.

https://github.com/semibran/graph-mst

:chart_with_upwards_trend: minimum spanning tree generator
https://github.com/semibran/graph-mst

graph-theory minimum-spanning-tree

Last synced: 12 months ago
JSON representation

:chart_with_upwards_trend: minimum spanning tree generator

Awesome Lists containing this project

README

          

# graph-mst
> generates a minimum spanning tree from a weighted graph

![demo](img/demo.gif)

This module exposes the `span` function, which uses [Prim's algorithm] to generate a [minimum spanning tree] from a weighted graph.

## usage

### `span(graph) -> tree`
Converts a `graph` with the fields `nodes : [ x, y ]` and `edges : { endpoints : [ ...nodeIndices ], weight: Number }` 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