Double check that you are processing the edges in the correct (sorted) order.