graph now uses Heap rather than Leftistheap