manual layout of graphs described in graphviz (DOT) format
Asked Answered
S

2

8

I have a graph that I've written down as a DOT file. I picked this because it's pretty easy to read and write programmatically, and I have a fair amount of tooling that uses the DOT file as input.

Graphviz does a decent job drawing it, but not a great job. (And that's all it's really meant to do, as far as I know.)

I am looking for, and cannot find, a tool that will read in the DOT file and let me manually drag around the vertices and edges I've already described in the DOT file similar to https://www.draw.io.

The thing that I really do not want to do is manually re-enter the graph I've already written down (or computed as output from a program or whatever) into draw.io and then have two different files that may or may not have the same set of edges and vertices because of transcription errors.

Ideally, I want something that will write its own file of only the metadata about where things are drawn, without adding a bunch of cruft to the DOT file, so that the tooling I have there still works and I can still use it as the unified representation of the graph between a bunch of different tasks.

Synagogue answered 26/4, 2016 at 16:47 Comment(0)
H
4

You can run dot requesting output as another dot file with the command dot -Tdot. dot will then calculate the layout but instead of outputting a pictorial representation, it will output another dot file with exactly the same information as the input, with the addition of layout information as additional attributes. You can then edit the layout information by hand and run it through dot a second time to obtain the pictorial representation.

If your tools process a dot file properly, they should be able to process a dot file with layout attributes.

If you want a WYSIWYG tool to aid in the hand-layout process, take a look at dotty.

Herbst answered 21/9, 2018 at 0:39 Comment(1)
dotty is deprecated.Hamby
R
3

Here is what I have done when I want to manually adjust the node positioning and edges that are drawn by dot:

  • tell dot to generate an SVG image: dot -Tsvg < graph_text.dot > output_image.svg
  • use an SVG editor such as Inkscape or Sketch (two that I have used) to open the SVG

When you open the SVG in an image editor that can handle the SVG format, each node and edge in the graph will be an independent draggable component.

Remaremain answered 8/2, 2017 at 22:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.