Skip to content

Visualization Using Graphviz

Mark Junker edited this page Jun 7, 2018 · 3 revisions

QuickGraph supports generating dot files, the file format of [Graphviz]. All Graphviz related code are located in the QuickGraph.Graphviz 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= ...;vargraphviz=newGraphvizAlgorithm<TVertex,TEdge>(g);// renderstringoutput=graphviz.Generate(newFileDotEngine(),"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 :)

publicinterfaceIDotEngine{// renders the dot code and returns the name of the generated filestringRun(GraphvizImageTypeimageType,stringdot,stringoutputFileName);}

Clone this wiki locally