0

Here is my graph:

graph

Is it possible to shift the "User-facing options" subgraph downward, so that "User-facing content" is above both that subgraph and the "Internal tags" subgraph? I tried using the technique described in https://stackoverflow.com/a/18410951/2954547 to force either topic or role to align with tag, but for some reason it really really wants to put the other node in that subgraph above the tag node, and not below it.

I see that you can also mess with the weight parameter to adjust the output, as in https://stackoverflow.com/a/14348263/2954547, but this just made the lines shorter and longer.

My desired output is to shift the left subgraph like so:

desired graph

Current source code:

digraph G {
  compound=true;
  newrank=true;

  subgraph cluster_userFacing {
    label="User-facing options";
    labelloc="bottom";
    role [label="User Role\n(User Classification)"];
    topic [label="Topic\n(External Tag)"];
  }

  subgraph cluster_content {
    label="User-facing Content";
    article [label="Article"];
    podcastEpisode [label="Podcast Episode"];
  }
  
  subgraph cluster_internal {
    label="Internal tags";
    labelloc="bottom";
    tag [label="Tag\n(Internal Tag)"];
    tagCategory [label="Tag Category"];
    tag -> tagCategory;
  }

  role -> tag [dir="none"];
  topic -> tag [dir="none"];

  article -> tag;
  podcastEpisode -> tag;
  
  { rank="min"; podcastEpisode; article; }
  
  { rank="same"; topic; tag; }
}
shadowtalker
  • 12,529
  • 3
  • 53
  • 96

1 Answers1

1

Enclosed the two clusters inside a new invisible (peripheries=0) cluster. Set constraint=false to override ranking. And added an invisible edge.

digraph G {

  node [height=.78]  // make all nodes same height
  subgraph clusterGroup{
    peripheries=0
  subgraph cluster_userFacing {
    peripheries=1
    label="User-facing options";
    labelloc="bottom";
    role [label="User Role\n(User Classification)" ]
    topic [label="Topic\n(External Tag)"];
  }
  subgraph cluster_internal {
    peripheries=1
    label="Internal tags";
    labelloc="bottom";
    tag [label="Tag\n(Internal Tag)" group=G];
    tagCategory [label="Tag Category"]; 
    tag -> tagCategory;
  }
 }

  subgraph cluster_content {
    label="User-facing Content";
    article [label="Article" ]
    podcastEpisode [label="Podcast Episode" group=G];
  }
  role  -> tag  [dir="none" constraint=false];
  topic -> tag  [dir="none" constraint=false];
  article -> tag  
  podcastEpisode -> tag;

  role -> topic [style=invis]
}

Giving:
enter image description here

sroush
  • 5,375
  • 2
  • 5
  • 11
  • That's quite messy. I love the basic Dot language, but it's sometimes very annoying how you have to go through these contortions to goad the layout engine produce good results. – shadowtalker Jan 26 '22 at 19:24