removed graph code, in seperate repo now
union-find algorithm