Пример #1
0
 /// <summary>
 /// Returns the given number of shortest paths between two nodes.
 /// </summary>
 /// <param name="graph">A bidirectional graph.</param>
 /// <param name="source">Source node of the path.</param>
 /// <param name="target">Target node of the path.</param>
 /// <param name="pathCount">The max. number of paths to be returned.</param>
 /// <returns>A collection of shortest paths between the two nodes.</returns>
 public static IEnumerable <Path <TVertex, TEdge> > GetShortestPaths <TVertex, TEdge>(this IBidirectionalGraph <TVertex, TEdge> graph,
                                                                                      TVertex source, TVertex target, int pathCount)
     where TEdge : IEdge <TVertex>
 {
     return(graph.RankedShortestPathHoffmanPavley(i => 1, source, target, pathCount)
            .Select(i => new Path <TVertex, TEdge>(i)));
 }