add check for edge count consistency