Table of Contents

Class DijkstraSets

Namespace
AlgorithmsSW.EdgeWeightedDigraph
Assembly
AlgorithmsSW.dll

A modified version of Dijkstra's algorithm that finds the shortest path from any of a set of sources to a set of sinks.

[ExerciseReference(4, 4, 25)]
public class DijkstraSets
Inheritance
DijkstraSets
Inherited Members
Extension Methods

Remarks

This implementation can be faster than vanilla Dijkstra since we can stop early once we found a sink.

Constructors

DijkstraSets(IEdgeWeightedDigraph<double>, IEnumerable<int>, IEnumerable<int>)

Initializes a new instance of the DijkstraSets class.

public DijkstraSets(IEdgeWeightedDigraph<double> graph, IEnumerable<int> sources, IEnumerable<int> sinks)

Parameters

graph IEdgeWeightedDigraph<double>

The graph to find the shortest paths in.

sources IEnumerable<int>

The source vertexes to find the shortest paths from.

sinks IEnumerable<int>

The sink vertexes to find the shortest paths to.

Exceptions

ArgumentException

graph contains negative weights.

Properties

Distance

public double Distance { get; }

Property Value

double

Path

public DirectedPath<double> Path { get; }

Property Value

DirectedPath<double>

PathExists

public bool PathExists { get; }

Property Value

bool