Hi Steve, have you had a chance to look at it?
Thanks for the commit. I tried on the previous example originally rendered like this:
Applying the -GTBbalance=min option (left) and -GTBbalance=max (right) gives:
The min case does not work well and print the following error:
Warning: flat edge between adjacent nodes one of which has a record shape - replace records with HTML-like labels Edge A -> G Error: lost A G edge
Regarding the max case (the one I am interested in) it seems to work fine on this example. However after trying few different layout I found that the following example is not rendered as expected with -GTBbalance=max:
digraph "Example"
{
node [shape=record];
A
B
C
D
E
F
G
A -> B
A -> D
B -> C
D -> B
D -> E
E -> F
F -> G
}
As you can see, the node B is too high as it is expected to be on the same rank as F. Would you have any idea why this is happening?
Hi Stephen, Thanks for confirming. No worries, let us know when it is merged.
Hi Steve,
Thanks for your answer, I have downloaded and compiled the source code graphviz-2.41.20171026.1811.tar.gz from the page https://graphviz.gitlab.io/_pages/Download/Download_source.html.
Then I did run the following commands:
/path/to/install/bin/dot -Tsvg graph.dot -o graph.svg
/path/to/install/bin/dot -Tsvg -GTBbalance=min graph.dot -o graph_min.svg
/path/to/install/bin/dot -Tsvg -GTBbalance=max graph.dot -o graph_max.svg
Here is the graph.dot source:
digraph "Example"
{
node [shape=record];
A
B
C
D
E
F
G
A -> B
B -> C
C -> D
A -> E
E -> F
A -> G
}
But it did not make any difference in the output. Also I am a bit surprised that the following command on the source code does not print any result:
grep -inr 'GTBbalance' graphviz-2.41.20171026.1811/
Did I miss anything obvious?
Thanks for your quick action on this. I tried to follow the instructions here "http://204.178.9.49/Download_linux_rhel.php" by putting graphviz-rhel.repo in /etc/yum.repos.d/
But I get the following message when running the command "yum list available 'graphviz*'": "http://www.graphviz.org/pub/graphviz/stable/redhat/el7Server/x86_64/os/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found" I also get the same using development instead of stable.
Is it the right place to fetch the above GTBbalance patch? Is it expected to work for RHEL7?
I noticed that in dot there is way to manually constraint the rank of a group of nodes within a graph with the command '{rank = same; ...}'. I used this functionality to obtain the desired output graph in my examples.
An approach that could work would be to first compute the ranks of all the nodes within the DAG and then to constraint the output graph using the same mechanism as the one used for the command '{rank = same; ...}'. That way we would keep the current objective function but with additional constraints represented by the command '{rank = same; ...}'.
Does it sounds like a realistic approach?
Thanks for your quick answer.
Indeed, the example above was not great. Here is an updated version below to avoid confusion between DAGs and tree. It seems to me that the rule above to assign ranks works on DAGs and not just trees. Did you have a simple case in mind that is not working?
Only assigning all the leaf nodes to be on the same rank does not work well when using the 'rank=same' attribute in the dot file, the above example results in node E being too high:
Let me know your thoughts.
Hi Graphviz,
I have an external program generating automatically directed acyclic graphs for dot program. Right now they are rendered like the following:
Instead I would like to have a graph where at the bottom you will find only leaf nodes. Then, just above, only nodes pointing only to leaf nodes. Then, just above, only nodes pointing only on nodes that have been already defined in the previous steps. And so on...
For the above graph the result would look like:
Is there currently a way to have this result using current Graphviz options (without having to manually specify the rank in the dot file)? If that is not the case would you consider this as a possible enhancement?
Thanks