Glacier.Graph 1.1.0

dotnet add package Glacier.Graph --version 1.1.0
                    
NuGet\Install-Package Glacier.Graph -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="Glacier.Graph" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Glacier.Graph" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Glacier.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 Glacier.Graph --version 1.1.0
                    
#r "nuget: Glacier.Graph, 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.
#:package Glacier.Graph@1.1.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=Glacier.Graph&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Glacier.Graph&version=1.1.0
                    
Install as a Cake Tool

Glacier.Graph Banner

Glacier.Graph

License: MIT .NET 10 Native AOT NuGet Version NuGet Downloads Ecosystem DEV.to Story Website Buy Me A Coffee

๐Ÿ“– Read the Deep-Dive: I built a zero-allocation C# knowledge graph because JVM graphs are too bloated.

========================================================================================================
  GLACIER.GRAPH TRAVERSAL BENCHMARK (ZERO-ALLOCATION FORWARD STAR CSR vs JVM NEO4J)
========================================================================================================
  JVM Neo4j (Heap-Allocated Traversal) :  50 โ€“ 200 ms latency per multi-hop query
  Glacier.Graph (Pure C# Contiguous CSR) :  0.010 โ€“ 0.650 ms (Sub-Millisecond Multi-Hop Traversal)
--------------------------------------------------------------------------------------------------------
  ๐Ÿ† SPEEDUP                            :  100x โ€“ 500x FASTER TRAVERSAL LATENCY
  โšก GC ALLOCATIONS                      :  0 BYTES (Bypasses .NET GC via Contiguous Primitive Arrays)
  โšก MEMORY FOOTPRINT                   :  < 10 MB (vs 2+ GB JVM Heap)
========================================================================================================

Glacier.Graph (v1.1.0) is a high-performance, zero-allocation, Native AOT-compatible graph database and traversal engine for .NET 10. Designed for AI agents, semantic knowledge graphs, and ultra-low-latency graph analytics, it pairs a concurrent Forward Star in-memory store with a memory-mapped / LRU-paged Compressed Sparse Row (CSR) engine, AVX-512 SIMD kernels, weighted Dijkstra pathfinding, and a zero-dependency MCP server.


Key Features

  • โšก Zero-Allocation Traversal (TraversalScratchWorkspace): Pooled primitive buffers and O(1) generation-tagged visited tracking achieve 0 bytes of GC heap allocation across BFS, DFS, weighted Dijkstra, and K-hop neighborhood Span<int> queries.
  • ๐Ÿš€ Thread-Safe Forward Star Engine (GraphStore): Contiguous primitive arrays (_head, _to, _relation, _next, _weights) protected by ReaderWriterLockSlim prevent torn Array.Resize reads under concurrent ingestion and querying.
  • ๐Ÿ—œ๏ธ Weighted CSR Memory-Mapped & Out-of-Core Execution (CsrGraphStore): Compile graphs into the compact GCSR v2 format storing row offsets, column indices, relation IDs, node metadata, and float edge weightsโ€”queried either via zero-copy MemoryMappedFile spans or a strictly bounded 64-bit LRU 4 KB software page cache (maxMemoryBytes).
  • ๐Ÿงฎ SIMD Hardware Intrinsics (CsrKernels): Vectorized neighbor scanning, bitmask index extraction, degree subtraction, and set intersection using Vector512 (AVX-512), Vector256 (AVX2), and Vector128 (SSE/AdvSIMD).
  • ๐Ÿ’พ Compact Binary Persistence (GLGR v2): Serializes only active node and edge slots via MemoryMarshal.AsBytes with strict header and truncated-file validation (InvalidDataException).
  • ๐Ÿค– 100% Native AOT MCP Server (GraphMcpServer): Source-generated System.Text.Json (GraphMcpJsonContext) JSON-RPC 2.0 server over UTF-8 stdio with atomic state swapping and opt-in stderr diagnostics (GLACIER_GRAPH_MCP_DEBUG=1).

Installation

Glacier.Graph is available as a NuGet package. Install it using the .NET CLI:

dotnet add package Glacier.Graph

Quick Start

1. Initialize the Graph Store & Add Weighted Edges

using Glacier.Graph.Storage;
using Glacier.Graph.Traversal;

using var store = new GraphStore(initialNodeCapacity: 100_000, initialEdgeCapacity: 500_000);

store.AddNode("User_1", "Developer");
store.AddNode("User_2", "Manager");

// Create directed relationships with optional non-negative weights (>= 0.0f)
store.AddEdge("User_1", "User_3", "DIRECT_ROUTE", weight: 5.0f);
store.AddEdge("User_1", "User_2", "REPORTS_TO", weight: 0.2f);
store.AddEdge("User_2", "User_3", "KNOWS", weight: 0.2f);

2. Unweighted BFS, Weighted Dijkstra, & K-Hop Neighborhoods

var search = new GraphSearch(store);

// Unweighted BFS (fewest hops: User_1 -> User_3)
List<string> bfsPath = search.FindShortestPath("User_1", "User_3");

// Weighted Dijkstra (lowest total weight 0.4 < 5.0: User_1 -> User_2 -> User_3)
List<string> weightedPath = search.FindShortestPathDijkstra("User_1", "User_3");

// Pure zero-allocation Span<int> query path
Span<int> pathBuffer = stackalloc int[64];
int length = search.FindShortestPathDijkstra(1, 3, pathBuffer);

// Discover all neighbors within 2 hops
List<string> neighbors = search.FindNeighborhood("User_1", maxHops: 2);

3. Compact RAM-to-Disk Serialization

// Persist active graph slots directly to disk (GLGR v2 binary schema)
store.SaveToDisk("graph_database.bin");

// Restore and validate graph database
using GraphStore loadedStore = GraphStore.LoadFromDisk("graph_database.bin");

4. Memory-Mapped & Out-of-Core Weighted CSR Execution

// Compile Forward Star topology + metadata + weights into compact GCSR v2 format
CsrGraphCompiler.CompileFromForwardStar(store, "graph_database.csr");

// Option A: High-throughput Memory-Mapped File (zero-copy Span<int> / Span<float> access)
using var csrMmf = new CsrGraphStore("graph_database.csr", useMemoryMapping: true);
var csrSearch = new CsrGraphSearch(csrMmf);
List<string> optimal = csrSearch.FindShortestPathDijkstra("User_1", "User_3");

// Option B: Strictly bounded 256 KB software LRU page cache for constrained hardware
using var csrPaged = new CsrGraphStore("graph_database.csr", maxMemoryBytes: 256 * 1024, useMemoryMapping: false);

MCP Server Setup

Glacier.Graph includes a Native AOT-ready MCP (Model Context Protocol) server runner allowing AI clients (such as Claude Desktop or Antigravity) to query, mutate, and persist graphs in real time.

1. Build the Host Runner

dotnet build src/Glacier.Graph.Host/Glacier.Graph.Host.csproj -c Release

2. Configure Your Client

{
  "mcpServers": {
    "glacier-graph": {
      "command": "dotnet",
      "args": [
        "ABS_PATH_TO_REPO/src/Glacier.Graph.Host/bin/Release/net10.0/Glacier.Graph.Host.dll",
        "ABS_PATH_TO_DATA/graph_database.bin"
      ]
    }
  }
}

3. Exposed MCP Tools

  • ping: Health check returning "pong".
  • add_node: Registers or updates a node and its metadata.
  • add_edge: Links two nodes with a typed relationship and optional weight.
  • find_shortest_path: Computes shortest path via BFS or weighted Dijkstra ("weighted": true).
  • find_neighborhood: Discovers all neighbors within maxHops.
  • save_graph / load_graph: Atomically persists or reloads graph snapshots from disk.

Architecture Documentation

See ARCHITECTURE.md for an in-depth technical breakdown of the Forward Star and GCSR v2 binary layouts, concurrency model, TraversalScratchWorkspace generation tagging, SIMD kernels, and Native AOT MCP pipeline.


๐Ÿ†• What's New in v1.1.0

  • Weighted CSR v2 Format & Real CSR Dijkstra โ€” CsrGraphCompiler and CsrGraphStore now persist, memory-map, and page per-edge float weights (GCSR v2 while retaining v1 read compatibility), powering true weighted CsrGraphSearch.FindShortestPathDijkstra including 0.0f zero-cost edges.
  • Full Concurrency Safety & Compact Serialization โ€” GraphStore (IDisposable), GraphSearch, and CsrGraphCompiler now synchronize read/write scopes across Array.Resize mutations with atomic EdgeEnumerator snapshots, and eliminate empty capacity bloat when saving .bin and .csr files.
  • Hardened CSR Bounds & Truncated-File Validation โ€” Strict header/offset/length validation (InvalidDataException), safe out-of-bounds internal ID handling, partial EOF page zeroing, and 64-bit long LRU access counters.
  • 100% Native AOT Compliance (<IsAotCompatible>true</IsAotCompatible>) โ€” GraphMcpServer refactored to source-generated GraphMcpJsonContext DTOs, atomic store swapping, and opt-in stderr logging (GLACIER_GRAPH_MCP_DEBUG).
  • 48 unit & adversarial stress tests passing with 0 warnings and 0 transitive vulnerabilities.

Contributing

We welcome community contributions! Please read CONTRIBUTING.md for local setup and PR guidelines.

Credits

Developed by Ian Cowley and Antigravity (Google DeepMind).

License

This project is licensed under the MIT License - see the LICENSE file for details.


โ„๏ธ Glacier Ecosystem & Support

Part of the Glacier Ecosystem โ€” high-performance, zero-allocation developer tooling and data engines natively built for modern C# and .NET 10.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Glacier.Graph:

Package Downloads
Glacier.DocTree

A blazing fast Markdown parser and semantic document tree representation optimized for AI and LLM context extraction, featuring native Glacier.Storage .gdoc binary persistence.

Glacier.Bundle

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 94 11/1/2026
1.0.5 117 10/12/2026
1.0.4 170 9/18/2026
1.0.3 205 5/20/2026
1.0.2 127 5/19/2026
1.0.1 133 5/19/2026
1.0.0 142 5/18/2026