Skip to content
Create DOT diagram using C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Initial commit Oct 8, 2017 Readme doc fix Mar 22, 2019


Create DOT/GraphViz diagram using C# / .Net

Available on NuGet: #


Create a graph (DotGraph)

var graph = new DotGraph("MyGraph");

var directedGraph = new DotGraph("MyDirectedGraph", true);

Create and add a node (DotNode)

var myNode = new DotNode("MyNode") {
    // Set all available properties
    Shape = DotNodeShape.Ellipse,
    Label = "My node !",
    FillColor = DotColor.Lightgrey,
    FontColor = DotColor.Black,
    Style = DotNodeStyle.Default,
    Height = 0.5f

// Add the node to the graph

Create and add an arrow (DotArrow)

// Create an arrow with node names
var myArrow = new DotArrow("myNode1", "myNode2");

// Create an arrow with node objects
var myArrow = new DotArrow(myNode1, myNode2) {
    // Set all available properties
    ArrowHeadShape = DotArrowShape.Normal;

// Add the arrow to the graph

Compile to DOT format

// Indented version
var dot = graph.Compile(false);

// Minified version
var dot = graph.Compile();

// Save it to a file
File.WriteAllText("", dot);
You can’t perform that action at this time.