Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increasing rank spacing in graphviz

Tags:

graphviz

d3.js

I have a graph laid out using D3 graphviz. It's laying out in a pretty dense way, and I'd like it to use more of the width of the screen.

a graph laid out in a way that doesn't use the whole screen

I have tried adjusing the ranksep and the ratio, but neither seem to have any effect. I've also tried changing the node border, to no effect. Changing the edge minlength just makes the edges look floppy. I can try giving every node an invisible child, but that seems like a horrible hack.

For clarity, by rank, I mean the horizontal spacing between the columns of nodes. (The graph is laid out left to right.)

Ideally I'd be able to give it an aspect ratio and it'd make the most of that space to lay out the graph in a way that doesn't need too much acrobatics.

  • Am I missing something obvious?
  • I may well be using the options incorrectly
  • or the D3 graphviz implementation may not have those features?
  • Is there no good way to do this?
like image 815
Ben Avatar asked Jun 12 '18 08:06

Ben


People also ask

What is rank in Graphviz?

Ranks and Subgraphs To work out the layout, Graphviz uses a system it calls "ranks". Each node is assigned a higher rank than the highest ranked node that point to it. If your rank direction is set to left to right ( rankdir=LR ), then nodes with a higher rank are placed further to the right.

What is Graphviz Neato?

neato is a reasonable default tool to use for undirected graphs that aren't too large (about 100 nodes), when you don't know anything else about the graph. neato attempts to minimize a global energy function, which is equivalent to statistical multi-dimensional scaling.

How do you make a graph on Graphviz?

Create a graph object, assemble the graph by adding nodes and edges, and retrieve its DOT source code string. Save the source code to a file and render it with the Graphviz installation of your system. Use the view option/method to directly inspect the resulting (PDF, PNG, SVG, etc.) file with its default application.


1 Answers

I have added :

size = "16.66,8.33!"; // 1200x600 at 72px/in, "!" to force
ratio = "fill"; // see https://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:ratio

at the beginning of the graph declaration (just after digraph G {).

It renders a wider output.

Have a try and tell.

like image 137
Setop Avatar answered Dec 07 '22 12:12

Setop