A topological investigation of phase transitions of cascading failures in power grids