DijkstraTools 1.0.0

Dijkstra Algorithm Toolset For .NET
With this toolset you can calculate the shortest path from one vertex to another via edges within a graph.

Install-Package DijkstraTools -Version 1.0.0
dotnet add package DijkstraTools --version 1.0.0
<PackageReference Include="DijkstraTools" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DijkstraTools --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Dijkstra Algorithm Toolset For .NET

With this toolset you can calculate the shortest path from one vertex to another via edges within a graph.

Example usage

// Let's initialize a graph
Graph<string> graph = new Graph<string>();

// have values for the vertices ready
string one = "one";
string two = "two";
string three = "three";
string four = "four";
string five = "five";

// Create vertices of it
Vertex<string> vertexOne = new Vertex<string>(one);
Vertex<string> vertexTwo = new Vertex<string>(two);
graph.AddVertex(vertexOne);
graph.AddVertex(vertexTwo);

// Or do so by adding values to the graph.
Vertex<string> vertexThree = graph.AddVertex(three);
Vertex<string> vertexFour = graph.AddVertex(four);
Vertex<string> vertexFive = graph.AddVertex(five);

// Add edges (connections) between the vertices
Edge<string> edgeOneTwo = new Edge<string>(vertexOne, vertexTwo, 1);
Edge<string> edgeOneThree = new Edge<string>(vertexOne, vertexThree, 3);
graph.AddEdge(edgeOneTwo);
graph.AddEdge(edgeOneThree);

// Or do so by adding edges to the graph directly
// AddEdge(start: Vertex<T>, end: Vertex<T>, weight: int, directed: bool, enabled: bool);
graph.AddEdge(vertexOne, vertexTwo, 1);
graph.AddEdge(vertexOne, vertexThree, 3);
graph.AddEdge(vertexOne, vertexFour, 5);
graph.AddEdge(vertexTwo, vertexFive, 30, true, true);
graph.AddEdge(vertexThree, vertexFive, 5);
graph.AddEdge(vertexFour, vertexFour, 1, true, false);

// Let's find a path
PathFinder<string> pathFinder = new PathFinder<string>(graph);
Path<string> path = pathFinder.FindPath(vertexOne, vertexFive);

// Path will be 1-3, 3-5 with a total weight of 8.

Dijkstra Algorithm Toolset For .NET

With this toolset you can calculate the shortest path from one vertex to another via edges within a graph.

Example usage

// Let's initialize a graph
Graph<string> graph = new Graph<string>();

// have values for the vertices ready
string one = "one";
string two = "two";
string three = "three";
string four = "four";
string five = "five";

// Create vertices of it
Vertex<string> vertexOne = new Vertex<string>(one);
Vertex<string> vertexTwo = new Vertex<string>(two);
graph.AddVertex(vertexOne);
graph.AddVertex(vertexTwo);

// Or do so by adding values to the graph.
Vertex<string> vertexThree = graph.AddVertex(three);
Vertex<string> vertexFour = graph.AddVertex(four);
Vertex<string> vertexFive = graph.AddVertex(five);

// Add edges (connections) between the vertices
Edge<string> edgeOneTwo = new Edge<string>(vertexOne, vertexTwo, 1);
Edge<string> edgeOneThree = new Edge<string>(vertexOne, vertexThree, 3);
graph.AddEdge(edgeOneTwo);
graph.AddEdge(edgeOneThree);

// Or do so by adding edges to the graph directly
// AddEdge(start: Vertex<T>, end: Vertex<T>, weight: int, directed: bool, enabled: bool);
graph.AddEdge(vertexOne, vertexTwo, 1);
graph.AddEdge(vertexOne, vertexThree, 3);
graph.AddEdge(vertexOne, vertexFour, 5);
graph.AddEdge(vertexTwo, vertexFive, 30, true, true);
graph.AddEdge(vertexThree, vertexFive, 5);
graph.AddEdge(vertexFour, vertexFour, 1, true, false);

// Let's find a path
PathFinder<string> pathFinder = new PathFinder<string>(graph);
Path<string> path = pathFinder.FindPath(vertexOne, vertexFive);

// Path will be 1-3, 3-5 with a total weight of 8.

Release Notes

First official release.

  • .NETStandard 2.0

    • No dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 172 10/23/2018