GraphvizWriter Class

Writes flowcharts in the DOT language of Graphviz, which GraphvizDocument.Parse reads back.

public static class GraphvizWriter

Remarks

The graph is a digraph; the subgraphs of the flowchart are clusters. The shapes of the flowcharts that Graphviz does not have are written as the closest shape of Graphviz, the styles of the classes are written on each element, and the theme (except its background), the curves of the edges other than straight and orthogonal ones, the markdown of the labels and the accessibility texts are not written.

Example

var flowchart = new FlowchartDiagram { Direction = DiagramDirection.LeftToRight };
var start = flowchart.AddNode("start", "Start", FlowchartNodeShape.Stadium);
var end = flowchart.AddNode("end_node", "End", FlowchartNodeShape.DoubleCircle);
flowchart.AddEdge(start, end, "done").LineStyle = FlowchartLineStyle.Dotted;

var dot = GraphvizWriter.Write(flowchart);

Methods

NameDescription
Write(FlowchartDiagram)Writes a flowchart in the DOT language.
Write(FlowchartDiagram, TextWriter)Writes a flowchart in the DOT language.

Write overloads

Write(FlowchartDiagram)

GraphvizWriter.cs

Writes a flowchart in the DOT language.

public static string Write(FlowchartDiagram diagram)
Parameters
diagram FlowchartDiagram
The flowchart.
Returns

string The DOT text, with line feeds.

Exceptions
ArgumentException
An identifier cannot be written in DOT: it ends with an odd number of backslashes and has unbalanced angle brackets.

Write(FlowchartDiagram, TextWriter)

GraphvizWriter.cs

Writes a flowchart in the DOT language.

public static void Write(FlowchartDiagram diagram, TextWriter writer)
Parameters
diagram FlowchartDiagram
The flowchart.
writer TextWriter
The writer the text is written to, with line feeds.
Exceptions
ArgumentException
An identifier cannot be written in DOT: it ends with an odd number of backslashes and has unbalanced angle brackets.