/* Pops a node from the PQ and checks whether it is
         * the destination node or was the last node in the PQ
         * and terminates the animation if necessary.  Colors
         * popNode and its incoming edge as appropriate.
         */
        private void step1()
        {
            if (!pq.Contains(graph.Home) && !popped.Contains(graph.Home))
            {
                graph.Home.Distance = 0;
                pq.Add(graph.Home);
            }
            updateText();
            if (pq.Count <= 0)
            {
                stepCount = -1;
                finalize(false);
                return;
            }
            popNode       = pq.Pop() as Node;
            popNode.Color = POPPED_N;

            if (incomingEdge[popNode] != null)
            {
                ((Edge)incomingEdge[popNode]).Color = POPPED_E;
            }

            popped.Add(popNode);
            if (popNode.Equals(graph.Destination))
            {
                stepCount = -1;
                finalize(true);
                return;
            }
            stepCount = 1;
        }