Trying to create ranked subgraphs in graphics

I tried to do something similar using Graphviz:

xyz | | | # | | a#__\| | # /#b | # #__\| # # /#c # d#/__# # #\ x # # | e#/__# | #\ # | 

But the rating does not seem to work as I expect. I want e be below all other nodes.

 digraph x { rankdir = tb; size = "7.5, 7.5"; rank = source; a -> b -> c -> d -> e; subgraph "cluster x" { style=filled; color=lightgrey; label="x"; a -> e [style=invis]; } subgraph "cluster y" { label="y"; b -> d [style=invis]; } subgraph "cluster z" { label="z"; c; } } 

First try

I tried using clusterrank = global , which works, but then the subgraphs are not split into a more obvious column and overlap over the columns. It will also not be to the right as I want. The following image highlights one of the overlaps in red, but as you can see there are 4.

Second attempt

 digraph x { rankdir = tb; rankstep=equally; clusterrank = global; size = "7.5, 7.5"; a -> b -> c -> d -> e; subgraph "cluster x" { style=filled; color=lightgrey; label="x"; a -> e [style=invis]; } subgraph "cluster y" { label="y"; b -> d [style=invis]; } subgraph "cluster z" { label="z"; c; } } 

I tried to create a separate cluster that will have a guaranteed top-down rating and then rank the corresponding clusters together, but it does the same as the previous attempt, deleting the boxes seen by the first attempt and causing an unwanted overlap.

 digraph x { rankdir = tb; 1 -> 2 -> 3 -> 4 -> 5; a -> b -> c -> d -> e; { rank=same; 1; a; } { rank=same; 2; b; } { rank=same; 3; c; } { rank=same; 4; d; } { rank=same; 5; e; } subgraph "cluster x" { style=filled; color=lightgrey; label="x"; a -> e [style=invis]; } subgraph "cluster y" { label="y"; b -> d [style=invis]; } subgraph "cluster z" { label="z"; c; } } 

3rd attempt

Anyone have any ideas to try and get the layout I want?

As a side note, I tried logging into the Graphviz forum on this, but found that logging in from this page does not seem to work. I have a problem with a long timeout. I check my email account and nothing exists. I am trying to create a new account with the same letter and it says that the account is already in use. Then I will try to get them to reset my password, and I get another timeout problem.

Does anyone know who I can contact to fix this nasty login issue? Maybe someone who is already logged in can post this for me?

+6
source share
2 answers

Launch a point with -Gnewrank. This will give you what you want based on your sketch. If more settings are required, indicate what you are after.

0
source

Your last solution will work as soon as you do a little setup

Use newrank=true to avoid unpacking clusters

Play with splines=... to set arrows

Define the label as separate nodes.

 digraph x { rankdir = tb; newrank=true; splines=ortho; 0 -> 1 -> 2 -> 3 -> 4 -> 5; X; Y; Z; a -> b -> c -> d -> e; { rank=same; 0 XYZ} { rank=same; 1; a; } { rank=same; 2; b; } { rank=same; 3; c; } { rank=same; 4; d; } { rank=same; 5; e; } subgraph "cluster x" { style=filled; color=lightgrey; a -> e [style=invis]; } subgraph "cluster y" { b -> d [style=invis]; } subgraph "cluster z" { c; } } 

enter image description here

0
source

Source: https://habr.com/ru/post/1011732/


All Articles