public node insert(int id, double distance, node prev = null)
        {
            //Create a new node.
            node n = new node(id, distance, heap.Count);
            //Set the prev value.
            n.prev = prev;
            heap.Add(n);
            pointers[id] = n;

            swapUp(n.index);

            return n;
        }
        public node insert(node n, node prev)
        {
            if (n.index > heap.Count)
                n.index = heap.Count;

            n.prev = prev;
            //O(1)
            heap.Add(n);
            //O(1)
            pointers[n.id] = n;

            //Move the node into the appropriate place in the queue. O(log|V|) swaps
            swapUp(n.index);

            return n;
        }
 public void update(int id, double distance, node prev)
 {
     //Updates the value and prev variables of a node.
     pointers[id].value = distance;
     pointers[id].prev = prev;
     //Move the node into the appropriate place in the queue.
     swapUp(pointers[id].index);
 }