Table of Contents

Class GraphDotExtensions

Namespace
Graph1x.Serialization
Assembly
Graph1x.dll

Exports graphs to the Graphviz DOT language. Output is deterministic (vertices in insertion order, edges in the graph's enumeration order — grouped by source vertex — and \n line endings) so it can be asserted, diffed, and cached; every identifier is quoted and escaped, so arbitrary vertex strings are safe.

public static class GraphDotExtensions
Inheritance
GraphDotExtensions
Inherited Members

Methods

ToDot<TVertex, TEdge>(IReadOnlyGraph<TVertex, TEdge>)

Renders the graph in DOT with default options.

public static string ToDot<TVertex, TEdge>(this IReadOnlyGraph<TVertex, TEdge> graph) where TVertex : notnull where TEdge : IEdge<TVertex>

Parameters

graph IReadOnlyGraph<TVertex, TEdge>

The graph to render.

Returns

string

The DOT document.

Type Parameters

TVertex

The vertex type.

TEdge

The edge type.

ToDot<TVertex, TEdge>(IReadOnlyGraph<TVertex, TEdge>, DotExportOptions<TVertex, TEdge>)

Renders the graph in DOT.

public static string ToDot<TVertex, TEdge>(this IReadOnlyGraph<TVertex, TEdge> graph, DotExportOptions<TVertex, TEdge> options) where TVertex : notnull where TEdge : IEdge<TVertex>

Parameters

graph IReadOnlyGraph<TVertex, TEdge>

The graph to render.

options DotExportOptions<TVertex, TEdge>

Rendering options.

Returns

string

The DOT document: digraph/-> for directed graphs, graph/-- for undirected ones.

Type Parameters

TVertex

The vertex type.

TEdge

The edge type.

Exceptions

ArgumentNullException

Either argument is null.