public static IEnumerable <TEdgeCustom> GetPathEdgesCustom <T, TEdgeCustom>(this ShortestPathResult result, Graph <T, TEdgeCustom> graph) where TEdgeCustom : IEquatable <TEdgeCustom> { if (result.IsFounded) { using (var iterator = result.GetPath().GetEnumerator()) { if (!iterator.MoveNext()) { yield break; } var currentNode = iterator.Current; while (iterator.MoveNext()) { yield return(GetFirstEdgeCustom(graph, currentNode, iterator.Current)); currentNode = iterator.Current; } } } else { throw new System.Exception("path not founded"); } }
public static IEnumerable <TEdgeCustom> GetReversedPathEdgesCustom <T, TEdgeCustom>(this ShortestPathResult result, Graph <T, TEdgeCustom> graph) where TEdgeCustom : IEquatable <TEdgeCustom> { return(result.GetPathEdgesCustom(graph).Reverse()); }