Esempio n. 1
0
        public ICollection <TEdge> MergedPath(TEdge se, IDictionary <TEdge, GraphColor> colors)
        {
            List <TEdge> path = new List <TEdge>();

            TEdge      ec = se;
            GraphColor c  = colors[ec];

            if (c != GraphColor.White)
            {
                return(path);
            }
            else
            {
                colors[ec] = GraphColor.Black;
            }

            path.Insert(0, ec);
            while (EdgePredecessors.ContainsKey(ec))
            {
                TEdge e = EdgePredecessors[ec];
                c = colors[e];
                if (c != GraphColor.White)
                {
                    return(path);
                }
                else
                {
                    colors[e] = GraphColor.Black;
                }

                path.Insert(0, e);
                ec = e;
            }
            return(path);
        }
Esempio n. 2
0
        public ICollection <TEdge> Path(TEdge se)
        {
            List <TEdge> path = new List <TEdge>();

            TEdge ec = se;

            path.Insert(0, ec);
            while (EdgePredecessors.ContainsKey(ec))
            {
                TEdge e = EdgePredecessors[ec];
                path.Insert(0, e);
                ec = e;
            }
            return(path);
        }