WaypointPathfinding 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package WaypointPathfinding --version 1.1.0                
NuGet\Install-Package WaypointPathfinding -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WaypointPathfinding" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WaypointPathfinding --version 1.1.0                
#r "nuget: WaypointPathfinding, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WaypointPathfinding as a Cake Addin
#addin nuget:?package=WaypointPathfinding&version=1.1.0

// Install WaypointPathfinding as a Cake Tool
#tool nuget:?package=WaypointPathfinding&version=1.1.0                

Waypoints pathfinding

This repository allows a user to pathfind using various algorithms using a graph data structure (called WaypointMap in the application, a node is called WaypointNode).

Currently supports only Dijkstra algorithm (only relative posiitons, no absolute ones necessary for A*).

Example use:

using WaypointPathfinding;

// Initialize a WaypointMap
WaypointMap map = new WaypointMap();

// Add empty, arbitrary points
for (int i = 0; i < 5; i++)
{
    
    WaypointNode node = new WaypointNode(i);
    map.AddWaypoint(node);
}

// Add arbitrary connections with distances
map.AddConnectionBetweenTwoNodes(map.Waypoints[0], map.Waypoints[1], 6);
map.AddConnectionBetweenTwoNodes(map.Waypoints[0], map.Waypoints[3], 1);
map.AddConnectionBetweenTwoNodes(map.Waypoints[1], map.Waypoints[3], 2);
map.AddConnectionBetweenTwoNodes(map.Waypoints[1], map.Waypoints[4], 2);
map.AddConnectionBetweenTwoNodes(map.Waypoints[1], map.Waypoints[2], 5);
map.AddConnectionBetweenTwoNodes(map.Waypoints[2], map.Waypoints[1], 5);
map.AddConnectionBetweenTwoNodes(map.Waypoints[2], map.Waypoints[4], 5);
map.AddConnectionBetweenTwoNodes(map.Waypoints[3], map.Waypoints[0], 1);
map.AddConnectionBetweenTwoNodes(map.Waypoints[3], map.Waypoints[1], 2);
map.AddConnectionBetweenTwoNodes(map.Waypoints[3], map.Waypoints[4], 1);
map.AddConnectionBetweenTwoNodes(map.Waypoints[4], map.Waypoints[3], 1);
map.AddConnectionBetweenTwoNodes(map.Waypoints[4], map.Waypoints[1], 2);
map.AddConnectionBetweenTwoNodes(map.Waypoints[4], map.Waypoints[2], 5);

// Initialize Dijkstra pathfinder
DijkstraPathfinder pathfinder = new DijkstraPathfinder(map);

// Obtain path a path. Returns a list of WaypointNode
var path = pathfinder.GetPath(map.Waypoints[0], map.Waypoints[2]);

// Iterate through path and print node IDs
foreach(var node in path)
{
    Console.WriteLine(node.Id);
}

The WaypointMapParser class contains useful formats to parse different formats into WaypointMap. Currently only supports parsing from a list of strings. Usage:

using Pathfinding;

var mapFromArray = WaypointMapParser.ParseArrayOfStrings(new List<string> { 
    "1;[2,5];[5.1,2.2]",
    "2;[1];[5.1]",
    "5;[1];[2.2]"
});

foreach (WaypointNode node in mapFromArray.Waypoints)
{
    Console.WriteLine("CONNECTIONS FOR" + node.Id.ToString());
    foreach (var kvp in node.ConnectionsAndDistances)
    {
        Console.WriteLine("Conn id=" + kvp.Key.Id + "has distance " + kvp.Value);
    }
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.