optimized greedy algorithms, still incorrect
largely improved, `causeCycle` still incorrect
i feel greedy!