Click or drag to resize
DijkstraUndirectedSP Class

The DijkstraUndirectedSP class represents a data type for solving the single-source shortest paths problem in edge-weighted graphs where the edge weights are nonnegative.

This implementation uses Dijkstra's algorithm with a binary heap. The constructor takes time proportional to E log V, where V is the number of vertices and E is the number of edges. Afterwards, the DistTo() and HasPathTo() methods take constant time and the PathTo() method takes time proportional to the number of edges in the shortest path returned.

See for a version on edge-weighted digraphs.

Inheritance Hierarchy
SystemObject
  Algs4NetDijkstraUndirectedSP

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class DijkstraUndirectedSP

The DijkstraUndirectedSP type exposes the following members.

Constructors
  NameDescription
Public methodDijkstraUndirectedSP
Computes a shortest-paths tree from the source vertex s to every other vertex in the edge-weighted graph G.
Top
Methods
  NameDescription
Public methodDistTo
Returns the length of a shortest path between the source vertex s and vertex v.
Public methodHasPathTo
Returns true if there is a path between the source vertex s and vertex v.
Public methodStatic memberMainTest
Demo test the DijkstraUndirectedSP data type.
Public methodPathTo
Returns a shortest path between the source vertex s and vertex v.
Top
Remarks

For additional documentation, see Section 4.4 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

This class is a C# port from the original Java class DijkstraUndirectedSP implementation by the respective authors.

See Also