Heap is modified to work only with graph nodes