Termination condition helper functions
Count topology diffs for terminate condition
Init e to -1, so we can ender first loop
Refactor main class with new Terminate condition