Solved a bug when checking edge degree 0.