Constructor
new MST(vertices, measure)
- Source:
Example
//known points, no edges
let mst = new MST([[0, 0], [23, 34], [5, 645]]);
mst.edgesDelaunay();
let tree = msg.calculate();
//known points and known edges
let mst = new MST([[0, 0], [23, 34], [5, 645]]);
mst.edges = [[0,1], [1,2]];
let tree = msg.calculate();
Parameters:
Name | Type | Default | Description |
---|---|---|---|
vertices |
Array | array of points |
|
measure |
function | null |
null
|
measure function, default is manhattan distance |
Methods
calculate() → {Array}
- Source:
calculate minimum spanning tree using kruskal algorithm
Returns:
- Type
- Array
edgesDelaunay()
- Source:
fill the edges array by connecting all edges