union-find ========== A basic union-find data structure for node.js. For more information, see wikipdia: [Disjoint Set Datastructures](http://en.wikipedia.org/wiki/Disjoint-set_data_structure) Union find data structures solve the incremental connectivity problem. (That is maintaining a spanning forest under incremental insertions of edges.) To handle fully dynamic connectivity, you can use a [dynamic forest](https://www.npmjs.org/package/dynamic-forest) data structure. Usage ===== Here is an example showing how to do connected component labelling. Assume we are given a graph with `VERTEX_COUNT` vertices and a list of edges stored in array represented by pairs of vertex indices: ```javascript //Import data structure var UnionFind = require('union-find') var VERTEX_COUNT = 8 var edges = [ [0,1], [1,2], [2,3], [5,6], [7,1] ] //Link all the nodes together var forest = new UnionFind(VERTEX_COUNT) for(var i=0; i