public BellmanFordShortestPath(EdgeWeightedDiGraph DG, int s)
        {
            EdgeTo = new DirectedEdgeAPI[DG.V];
            DistTo = new double[DG.V];

            for (int i = 0; i < DG.V; i++)
            {
                DistTo[i] = double.PositiveInfinity;
            }

            DistTo[s] = 0;

            for (int i = 0; i < DG.V; i++)
            {
                for (int v = 0; v < DG.V; v++)
                {
                    foreach (var e in DG.Adj(v))
                    {
                        EdgeRelaxation(e);
                    }
                }
            }
        }
        public DijkstraShortestPath(EdgeWeightedDiGraph DG, int s)
        {
            //s = 96;
            EdgeTo   = new DirectedEdgeAPI[DG.V];
            DistTo   = new double[DG.V];
            pq       = new IndexedMinPQ <double>(DG.V);
            mapEdges = new Dictionary <string, bool>();

            for (int i = 0; i < DG.V; i++)
            {
                DistTo[i] = double.PositiveInfinity;
            }

            DistTo[s] = 0;

            pq.insert(s, 0.0);

            while (!pq.isEmpty())
            {
                int             v     = pq.deleteMin();
                string          align = string.Empty;
                bool            verticallyReachable   = false;
                bool            horizontallyReachable = false;
                DirectedEdgeAPI horiEdge  = null;
                DirectedEdgeAPI vertiEdge = null;
                foreach (DirectedEdgeAPI e in DG.Adj(v))
                {
                    var v1  = e.From();
                    var v2  = e.To();
                    var key = v1 < v2 ? v1 + "|" + v2 : v2 + "|" + v1;

                    if (mapEdges.ContainsKey(key))
                    {
                        align = DG.dict[key];

                        if (align == "H")
                        {
                            horizontallyReachable = true;
                            horiEdge = e;
                        }
                        else if (align == "V")
                        {
                            verticallyReachable = true;
                            vertiEdge           = e;
                        }
                    }
                }

                foreach (DirectedEdgeAPI e in DG.Adj(v))
                {
                    var v1  = e.From();
                    var v2  = e.To();
                    var key = v1 < v2 ? v1 + "|" + v2 : v2 + "|" + v1;

                    //if (mapEdges.ContainsKey(key))
                    //{
                    //    continue;
                    //}

                    EdgeRelaxation(e, horizontallyReachable, verticallyReachable, DG.dict, s);


                    if (!mapEdges.ContainsKey(key))
                    {
                        mapEdges.Add(key, true);
                    }
                }
            }
        }