Fix bug that capacity_scaling does not saturate negative selfloops

A test is added to cover the case.

Also included is some changes to the heap interface and `BinaryHeap` implementation that gives ~1.2x speedup to  `capacity_scaling`. This invalidates the previous random test cases, so new, more sensible ones are substituted.