Search code examples
c#graphquickgraph

Render a gif or png when using QuickGraph (instead of a .dot file)


I m trying out quickgraph and when I remder like this:

var graphviz = new GraphvizAlgorithm<string, SEdge<string>>(g);     
graphviz.ImageType = GraphvizImageType.Gif;
var output = graphviz.Generate(new FileDotEngine(), "graph");

of course i get a Dot file called graph, I m pretty sure there are other ways, or maybe I need to transform the dot file into png some other way? I know I could use gedit.exe but there must be a programmatic way to generate an image thanks


Solution

  • I m using graphviz, in the bin folder of the installation there is a tool called dot.exe to use it from the command line I m doing something like:

    dot -Tpng graph.dot > graph.png
    

    Then use Process to call it