// Build a minimum spanning forest of this collection, treating its edges as undirected
eles.kruskal(weight?: WeightFn): Collection<NodeData, EdgeData>Build a minimum spanning forest of this collection, treating its edges as undirected. Equal-weight edges retain collection order. Disconnected input produces one tree per connected component.
| Name | Description |
|---|---|
weight: WeightFn? |
|
Returns
Collection<NodeData, EdgeData>a collection containing all input nodes and the accepted forest edges, in acceptance order
Example
const forest = eles.kruskal(edge => edge.data('weight'));console.log(forest.edges().length); // 2