BreadthFirstDirectedPaths Class |
The BreadthDirectedFirstPaths class represents a data type for finding shortest paths (number of edges) from a source vertex S (or set of source vertices) to every other vertex in the digraph.
This implementation uses breadth-first search. The constructor takes time proportional to V + E, where V is the number of vertices and E is the number of edges. It uses extra space (not including the digraph) proportional to V.
Namespace: Algs4Net
public class BreadthFirstDirectedPaths
The BreadthFirstDirectedPaths type exposes the following members.
Name | Description | |
---|---|---|
![]() | BreadthFirstDirectedPaths(Digraph, IEnumerableInt32) |
Computes the shortest path from any one of the source vertices in sources
to every other vertex in graph G. |
![]() | BreadthFirstDirectedPaths(Digraph, Int32) |
Computes the shortest path from s and every other vertex in graph G. |
Name | Description | |
---|---|---|
![]() | DistTo |
Returns the number of edges in a shortest path from the source s
(or sources) to vertex v? |
![]() | HasPathTo |
Is there a directed path from the source s (or sources) to vertex v? |
![]() ![]() | MainTest |
Demo test the BreadthFirstDirectedPaths data type. |
![]() | PathTo |
Returns a shortest path from s (or sources) to v, or
null if no such path. |
For additional documentation, see Section 4.2 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
This class is a C# port from the original Java class BreadthFirstDirectedPaths implementation by the respective authors.