Modified so that homodromiccycle accepts inversion of multiple cycles.