DotSharp.Core 0.1.0

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

DotSharp.Core

A clean-room C# reimplementation of the GraphViz dot engine — the hierarchical (layered, Sugiyama-style) layout algorithm for directed graphs from Gansner, Koutsofios, North & Vo, "A Technique for Drawing Directed Graphs" (IEEE TSE, 1993).

Parse the DOT language, lay the graph out with the same five-phase pipeline GraphViz uses, and emit SVG, GraphViz -Tplain / -Tdot, or just the computed coordinates to render however you like — all in managed code, no native dot.exe required at runtime.

Install

dotnet add package DotSharp.Core

Targets netstandard2.1 and net8.0. Pulls in SkiaSharp for the optional native (non-SVG) render backend; if you only need coordinates or SVG you can ignore it.

Quick start

using DotSharp.Dot;
using DotSharp.Layout;
using DotSharp.Render;

var graph   = DotParser.Parse("digraph { a -> b -> c; a -> c; }");
var layout  = LayoutEngine.Layout(graph);          // ranks + X/Y
var splines = SplineRouter.Route(graph, layout);   // edge routes

// 1) Render to SVG
string svg = SvgRenderer.Render(graph, layout, splines);

// 2) …or emit GraphViz-compatible plain text  (-Tplain)
string plain = PlainWriter.Write(graph, layout, splines);

// 3) …or read the coordinates yourself
foreach (var n in layout.Nodes)
{
    if (n.IsVirtual) { continue; }                 // skip long-edge waypoints
    Console.WriteLine($"{n.Original!.Name}: ({n.X}, {n.Y})");
}

What it does

A faithful re-creation of the dot pipeline:

  1. acyclic — break cycles by reversing back edges.
  2. rank — integer ranks via network simplex (low/lim + cut-value recurrence + rank balancing); virtual nodes inserted so every edge spans one rank.
  3. mincross — within-rank ordering by median + transpose (brute-force-optimal on small ranks).
  4. position — X by network simplex on the auxiliary graph + balancing sweeps; Y from rank × ranksep.
  5. splines — edges routed as Bézier splines (Schneider box-fit) through the inter-rank channels.

Plus a DOT parser (scoping, ports, clusters, strict, rank=same/min/max), record/Mrecord labels, polygon & named shapes, arrowheads, styles, multi-line labels, cluster boxes, disconnected- component packing, and Times-New-Roman-calibrated node sizing.

Fidelity

Output is diffed against the real dot.exe in the test suite:

  • Ranks — exact match.
  • Crossings — ≤ dot, and provably optimal on small graphs.
  • Node sizing — ~99% (box) / ~96% (ellipse); bounding box within ~1%.

Remaining differences are sub-pixel numerical tie-breaks (inherent to non-unique optima — two GraphViz builds differ there too) and HTML-<table> labels, which are not implemented.

License & provenance

MIT. DotSharp is written from the published papers and the public DOT language spec; the GraphViz source (EPL/CPL) is consulted only to understand behavior, never transliterated.

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 is compatible.  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 DotSharp.Core:

Package Downloads
DiagramStudio.Core

The UI-free engine behind DiagramStudio: a dependency-light core for node-link and swimlane diagrams. Document model (shapes, links, lanes, auto-resizing containers, shape data) with versioned JSON persistence; a backend-neutral scene renderer; orthogonal/straight/Bezier connectors plus obstacle-avoiding routing; layered (Sugiyama), tree, radial, force-directed, circular, grid and lane-aware layouts; graph analysis (topological order, cycles, shortest path, components); and clean-room GraphViz DOT + Microsoft Visio .vsdx read/write interop built on the in-box System.IO.Packaging. No WPF, no commercial dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 129 6/14/2026