Skip to content

Convert dot files to dgml -- Written in the great D language

Notifications You must be signed in to change notification settings

timepp/dot2dgml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dot2dgml

introduction

Convert from graphviz dot digraph to microsoft dgml format.

Graphviz dot invents the simplest style for modeling dependencies. But output formats are all static -- it's hard to do further processing on them. On the contrast, Microsoft Visual Studio has great support on dgml file format (another language for directed graph). You can easily view and edit the dependencies (drag, assign color, re-layout...) in Visual Studio.

dot2dgml is the tool to translate the easy-to-write dot language to the easy-to-view dgml language. So your idea can start up from scratch easily.

features & limitations

dot2dgml do loose syntax check on dot language to minimize the required steps to dgml:

  • the graph statement can be ommited.
  • minor syntax errors will be ignored.

the shortest valid non-trival input is:

a->b

dot2dgml has limitations as well:

  • Unicode input should be utf-8 encoded. If you want to pipe output to dot2dgml: On Windows command line, run chcp 65001 beforehand; On Linux command line, set LANG to UTF-8.
  • sub-graph is not supported as for now.
  • only color, fillcolor and fontcolor attributes are translated and verified to work in dgml. All other attributes are plainly copied to dgml and will work if you are very lucky.
  • HTML labels are not supported as it's not supported by DGML.
  • As DGML don't support undirected edges, so each undirected edge a--b are translated to 2 directed edges a->b and b->a

examples

The following command:

echo -n "a->b->c b->d" | dot2dgml -o abcd.dgml

will produce abcd.dgml with following content:

<DirectedGraph xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
    <Node Label="d" Id="d" />
    <Node Label="a" Id="a" />
    <Node Label="b" Id="b" />
    <Node Label="c" Id="c" />
</Nodes>
<Links>
    <Link Target="b" Source="a" />
    <Link Target="c" Source="b" />
    <Link Target="d" Source="b" />
</Links>
</DirectedGraph>

Open abcd.dgml with visual studio, you will see something like this:

abcd dgml at visual studio

Then you can drag/colorize/group/flag... in the rich featured editor. Enjoy!!!

More examples:

BCPL [fillcolor=#008000;fontcolor=#ffff00] BCPL->B->C C->C++ [color=red] Simula->C++ [color=red]

C++ dependencies

About

Convert dot files to dgml -- Written in the great D language

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages