user523774
user523774

Reputation: 31

C# - Parsing tool for the DOT Language

I have a .dot file and I need to use c# to generate an image for the DOT Language file. Is there any tool can help me to do so?

Thanks!

Upvotes: 3

Views: 1935

Answers (2)

SpacemanSpiff
SpacemanSpiff

Reputation: 249

There are several NuGet packages that does this. For example DotBuilder by Toby Rogers which will let you build a graph and render it using your graphviz installation like this:

    var gv = new GraphViz(@"C:\Develop\Tools\graphviz\bin", OutputFormat.Svg);
    using (var stream = new FileStream(@"c:\artifacts\dotbuilder\test.svg", FileMode.Create))
    {
        gv.RenderGraph(graph, stream);
    }

What it does for the rendering is really just a command line call to the graphviz binary which you could also do directly from your own code if you prefer to not use third-party tool.

Upvotes: 0

smirkingman
smirkingman

Reputation: 6368

This DOT grammar for Gold Parser allows you to parse a .DOT file.

To actually produce images, you can use DOT, NEATO, etc from AT&T Graphiz

If you want to do it in Visio, my addin for Visio is a free option (and a shameless plug). BTW, it's open source

A word of friendly advice: parsing DOT is relatively easy; making the results into a picture is considerably harder.

Upvotes: 3

Related Questions