Reputation: 81
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.
Upvotes: 8
Views: 2700
Reputation: 4110
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
.
Upvotes: 4
Reputation: 4233
Here is what I have done when I want to manually adjust the node positioning and edges that are drawn by dot:
dot -Tsvg < graph_text.dot > output_image.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.
Upvotes: 3