public ICollection <TEdge> Path(TEdge se) { List <TEdge> path = new List <TEdge>(); TEdge ec = se; path.Insert(0, ec); TEdge e; while (EdgePredecessors.TryGetValue(ec, out e)) { path.Insert(0, e); ec = e; } return(path); }
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); TEdge e; while (EdgePredecessors.TryGetValue(ec, out e)) { c = colors[e]; if (c != GraphColor.White) { return(path); } else { colors[e] = GraphColor.Black; } path.Insert(0, e); ec = e; } return(path); }