add a disjoint set data structure

I might not need a graph at all to handle the constraints
keep disjoint stuff in another branch