removing only degenerate edges