core :: DisjointSet :: nfind
Use path compression to flatten the structure
ENSURE: result.parent == result
# Get the root node of a node
# Use *path compression* to flatten the structure
# ENSURE: `result.parent == result`
private fun nfind(ne: DisjointSetNode): DisjointSetNode
do
var nf = ne.parent
if nf == ne then return ne
var ng = nfind(nf)
ne.parent = ng
return ng
end
lib/core/collection/union_find.nit:100,2--110,4