reduce identical edges