Popular recipes tagged "forests"http://code.activestate.com/recipes/tags/forests/2010-05-10T20:32:15-07:00ActiveState Code RecipesUnion-Find (Python) 2010-05-10T20:32:15-07:00Ahmed El Deebhttp://code.activestate.com/recipes/users/4173897/http://code.activestate.com/recipes/577225-union-find/ <p style="color: grey"> Python recipe 577225 by <a href="/recipes/users/4173897/">Ahmed El Deeb</a> (<a href="/recipes/tags/disjoint/">disjoint</a>, <a href="/recipes/tags/forests/">forests</a>, <a href="/recipes/tags/set/">set</a>, <a href="/recipes/tags/unionfind/">unionfind</a>). </p> <p>A.k.a. Disjoint set forests. Minimalistic implementation. Directly ported from pseudo code on the Wikipedia page: <a href="http://en.wikipedia.org/wiki/Disjoint-set_data_structure">http://en.wikipedia.org/wiki/Disjoint-set_data_structure</a></p> <p>Employs path compression and union by rank as described in the link above.</p>