This project is read-only.

Visualization Using Graphviz

QuickGraph supports generating dot files, the file format of Graphviz. All Graphviz related code are located in the QuickGraph.Graphviz.dll assembly.
Basic graph rendering
The GraphvizAlgorithm class contains the logic to render a IVertexAndEdgeListGraph.
  • GraphFormat, CommonVertexFormat and CommonEdgeFormat control the default 'looks' of the generated graph,
  • FormatVertex and FormatEdge events let you customize the display of individual vertices and edges.

IVertexAndEdgeListGraph<TVertex,TEdge> g= ...;
var graphviz = new GraphvizAlgorithm<TVertex,TEdge>(g);

// render
string output = graphviz.Generate(new FileDotEngine(), "graph");

Custom Rendering of Dot
QuickGraph sends the generated dot code to a 'dot engine' interface which is supposed to do the rest of the work. This is where you can plugin and add any additional steps. QuickGraph provides a simple rendering engine that writes the dot file to disk :)

public interface IDotEngine
    // renders the dot code and returns the name of the generated file
    string Run(
        GraphvizImageType imageType,
        string dot,
        string outputFileName);

Last edited Aug 22, 2009 at 10:15 AM by pelikhan, version 4


mrichman Aug 29, 2014 at 1:31 PM 
How do I put labels on the vertices?

steven_sheu Apr 2, 2012 at 9:21 AM 
When I use Basic graph rendering:

string output = graphviz.Generate(new FileDotEngine(), "graph");
Compiler can not find FileDotEngine. Is there any way to work around? Help, please.

sukru Sep 14, 2010 at 9:02 PM 
One needs a parser for that. I've built a limited one for a project (that works for only certain sets of inputs). However it's not very difficult.

RWhittten Aug 11, 2010 at 9:19 PM 
And how can you do the reverse? say ...
var grapviz = new FileDotEngine().Load(@"C:\");