This is wrong when `mergeGraph_.hasEdgeId(pq_.top())==false`. Refactor the 'while()` part of `contractionEdge()` into a helper function which is called in both `contractionEdge()` and `contractionWeight()`.