IRI.Maptor.Core.Graph 3.0.0

dotnet add package IRI.Maptor.Core.Graph --version 3.0.0
                    
NuGet\Install-Package IRI.Maptor.Core.Graph -Version 3.0.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="IRI.Maptor.Core.Graph" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IRI.Maptor.Core.Graph" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="IRI.Maptor.Core.Graph" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add IRI.Maptor.Core.Graph --version 3.0.0
                    
#r "nuget: IRI.Maptor.Core.Graph, 3.0.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.
#:package IRI.Maptor.Core.Graph@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=IRI.Maptor.Core.Graph&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=IRI.Maptor.Core.Graph&version=3.0.0
                    
Install as a Cake Tool

IRI.Maptor.Core.Graph

NuGet Target

Graph data structures and algorithms for the Maptor stack, inspired by the graph chapters of CLRS (Introduction to Algorithms). Supports directed and undirected weighted graphs with the classic traversal, shortest-path, spanning-tree, and connectivity algorithms.

Installation

dotnet add package IRI.Maptor.Core.Graph

Features

  • Adjacency-list representation (AdjacencyList<TNode, TWeight>) with directed and undirected weighted edges, plus a DirectedAcyclicGraph type; matrix-based algorithm variants accept a Matrix adjacency input
  • Traversal: breadth-first search (BreadthFirstSearch) and depth-first search (DepthFirstSearch, FastDepthFirstSearch) with topological sort and cycle detection
  • Shortest paths: Dijkstra (DijkstraProblem, adjacency-matrix input), Bellman-Ford (BellmanFordProblem, BellmanFordMatrixProblem; handles negative weights and detects negative cycles), Floyd-Warshall all-pairs (FloydWarshallProblem)
  • Minimum spanning tree: Kruskal (MinimumSpanningTree.CalculateByKruskal) and Prim (PrimAlgorithm)
  • Strongly connected components (GraphHelper.GetStronglyConnectedComponents)
  • Minimum cut (MinimumCut.GetMinCut) and greedy clustering (GreedyClustering)

Usage

Build a graph and run BFS:

using IRI.Maptor.Core.Graph;

var g = new AdjacencyList<string, int>();

g.AddDirectedEdge("A", "B", 1);
g.AddDirectedEdge("A", "C", 1);
g.AddDirectedEdge("B", "D", 1);
g.AddDirectedEdge("C", "D", 1);

var bfs = new BreadthFirstSearch<string, int>(g, startNode: "A");

double level = bfs.GetLevel("D");   // 2
var path = bfs.GetPathTo("D");      // ["A", "B", "D"] or ["A", "C", "D"]

Bellman-Ford with negative weights:

var graph = new AdjacencyList<string, double>();
graph.AddDirectedEdge("A", "B", 4.0);
graph.AddDirectedEdge("B", "C", -3.0);  // negative weight allowed
graph.AddDirectedEdge("C", "D", 5.0);

var bellmanFord = new BellmanFordProblem<string, double>(graph, "A");

if (!bellmanFord.HasNegativeCycle)
{
    double distance = bellmanFord.GetDistance("D");
    var path = bellmanFord.GetShortestPath("D");
}

Minimum spanning tree and strongly connected components:

var ug = new AdjacencyList<string, int>();
ug.AddUndirectedEdge("A", "B", 4);
ug.AddUndirectedEdge("A", "C", 1);
ug.AddUndirectedEdge("B", "C", 3);

var mstKruskal = MinimumSpanningTree.CalculateByKruskal<string, int>(ug);
var mstPrim = new PrimAlgorithm<string, int>(ug).GetMinimumSpanningTree();

// each inner list is one strongly connected component of a directed graph
var components = GraphHelper.GetStronglyConnectedComponents<string, int>(g);

See also


NuGet package · Report issues · Back to IRI.Maptor.Core

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on IRI.Maptor.Core.Graph:

Package Downloads
IRI.Maptor.Core.Spatial

A .NET standard library to work with spatial types, structures and algorithms (GeoJson, Geometry, KdTree, RTree, Delaunay, Simplification, etc.)

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 253 8/23/2026
3.0.0-alpha 245 8/22/2026