public bool Remove(int node) { int i = heapback[node]; if (i == -1) return false; heapswap(i, heap.Length() - 1); heap.Pop(); costs.Pop(); heapify_down(i); heapback[node] = -1; return true; }