Greetings fellow visualizers. I have a system that reads data from our CM database and renders architectural dependency diagrams. Sometimes the diagram is not centered. Consider the follow example:
[dot]
digraph “Admitto”{
splines=ortho
layout=dot
newrank=true
node [shape=none,fontsize=12]
graph [label=“2024-11-07 15:09:38-0500”,labelloc=b,fontsize=7]
subgraph clusterall {graph [label=“Admitto (Database Middleware & ERP Support (DBA)/103666)”,labelloc=t,fontsize=25,color=transparent]
edge [penwidth=1.0,arrowsize=0.5]
subgraph clusterranks{label=“”;margin=0
edge [color=transparent]
node [fontcolor=transparent,fontsize=0,width=0.01,fixedsize=true,label=“”,margin=“0,0”]
r0 → r1 → r2 → r3}
subgraph clusterkey { color=black
graph [label=“Archtitectural layer color key”,fontsize=12]
edge [color=transparent]
node [fontsize=12]
Servicekey [label=“Service”,style=filled,fillcolor=lightgoldenrodyellow]
Appkey [label=“App”,style=filled,fillcolor=khaki1]
MiddleTierkey [label=“MiddleTier”,style=filled,fillcolor=khaki2]
Databasekey [label=“Database”,style=filled,fillcolor=khaki3]
Serverkey [label=“Server”,style=filled,fillcolor=lightsteelblue1]
“Infrastructure Servicekey” [label=“Infrastructure Service”,style=filled,fillcolor=lightsteelblue2]
“Configuration Managementkey” [label=“Configuration Management”,style=filled,fillcolor=lightsteelblue]
Appliancekey [label=“Appliance”,style=filled,fillcolor=lightsteelblue3]
Rackkey [label=“Rack”,style=filled,fillcolor=lightyellow3]
Powerkey [label=“Power”,style=filled,fillcolor=snow3]
{rank=same;r0;Servicekey;Appkey;MiddleTierkey;Databasekey;Serverkey;“Infrastructure Servicekey”;“Configuration Managementkey”;Appliancekey;Rackkey;Powerkey}
Servicekey → Appkey → MiddleTierkey → Databasekey → Serverkey → “Infrastructure Servicekey” → “Configuration Managementkey” → Appliancekey → Rackkey → Powerkey}
subgraph Service {style=filled;fillcolor=lightgoldenrodyellow
node [style=filled,fillcolor=lightgoldenrodyellow]
graph [label=“Services”,fontsize=18]
}
subgraph App {style=filled;fillcolor=khaki1
node [style=filled,fillcolor=khaki1]
graph [label=“Applications”,fontsize=18]
}
subgraph Middle {style=filled;fillcolor=khaki2
node [style=filled,fillcolor=khaki2]
graph [label=“Middle Tier”,fontsize=18]
“104499” [label=“WebLogic Admitto\n104499”,group=a]
}
{rank=same;r1;104499}
subgraph Database {style=filled;fillcolor=khaki3
node [style=filled,fillcolor=khaki3]
graph [label=“Databases”,fontsize=18]
}
subgraph Server {style=filled;fillcolor=lightsteelblue1
node [style=filled,fillcolor=lightsteelblue1]
graph [label=“Servers”,fontsize=18]
“102260” [label=“Admittop Pool\n102260”,group=a]
“102408” [label=“admittop1\n102408”,group=a]
“102409” [label=“admittop2\n102409”,group=a]
}
{rank=same;r2;102260}
{rank=same;r3;102408;102409}
subgraph iService {style=filled;fillcolor=lightsteelblue2
node [style=filled,fillcolor=lightsteelblue2]
graph [label=“Infrastructure Services”,fontsize=18]
}
subgraph cm {style=filled;fillcolor=lightsteelblue
node [style=filled,fillcolor=lightsteelblue]
graph [label=“Configuration Management”,fontsize=18]
}
subgraph Appliance {style=filled;fillcolor=lightsteelblue3
node [style=filled,fillcolor=lightsteelblue3]
graph [label=“Appliances”,fontsize=18]
}
subgraph Rack {style=filled;fillcolor=lightyellow3
node [style=filled,fillcolor=lightyellow3]
graph [label=“Racks”,fontsize=18]
}
subgraph Power {style=filled;fillcolor=snow3
node [style=filled,fillcolor=snow3]
graph [label=“Power”,fontsize=18]
}
“104499” → “102260”
“102260” → “102408”
“102260” → “102409”
}}
[/dot]
Here is the code that was generated by the system:
digraph “Admitto”{
splines=ortho
layout=dot
newrank=true
node [shape=none,fontsize=12]
graph [label=“2024-11-07 15:09:38-0500”,labelloc=b,fontsize=7]
subgraph clusterall {graph [label=“Admitto (Database Middleware & ERP Support (DBA)/103666)”,labelloc=t,fontsize=25,color=transparent]
edge [penwidth=1.0,arrowsize=0.5]
subgraph clusterranks{label=“”;margin=0
edge [color=transparent]
node [fontcolor=transparent,fontsize=0,width=0.01,fixedsize=true,label=“”,margin=“0,0”]
r0 → r1 → r2 → r3}
subgraph clusterkey { color=black
graph [label=“Archtitectural layer color key”,fontsize=12]
edge [color=transparent]
node [fontsize=12]
Servicekey [label=“Service”,style=filled,fillcolor=lightgoldenrodyellow]
Appkey [label=“App”,style=filled,fillcolor=khaki1]
MiddleTierkey [label=“MiddleTier”,style=filled,fillcolor=khaki2]
Databasekey [label=“Database”,style=filled,fillcolor=khaki3]
Serverkey [label=“Server”,style=filled,fillcolor=lightsteelblue1]
“Infrastructure Servicekey” [label=“Infrastructure Service”,style=filled,fillcolor=lightsteelblue2]
“Configuration Managementkey” [label=“Configuration Management”,style=filled,fillcolor=lightsteelblue]
Appliancekey [label=“Appliance”,style=filled,fillcolor=lightsteelblue3]
Rackkey [label=“Rack”,style=filled,fillcolor=lightyellow3]
Powerkey [label=“Power”,style=filled,fillcolor=snow3]
{rank=same;r0;Servicekey;Appkey;MiddleTierkey;Databasekey;Serverkey;“Infrastructure Servicekey”;“Configuration Managementkey”;Appliancekey;Rackkey;Powerkey}
Servicekey → Appkey → MiddleTierkey → Databasekey → Serverkey → “Infrastructure Servicekey” → “Configuration Managementkey” → Appliancekey → Rackkey → Powerkey}
subgraph Service {style=filled;fillcolor=lightgoldenrodyellow
node [style=filled,fillcolor=lightgoldenrodyellow]
graph [label=“Services”,fontsize=18]
}
subgraph App {style=filled;fillcolor=khaki1
node [style=filled,fillcolor=khaki1]
graph [label=“Applications”,fontsize=18]
}
subgraph Middle {style=filled;fillcolor=khaki2
node [style=filled,fillcolor=khaki2]
graph [label=“Middle Tier”,fontsize=18]
“104499” [label=“WebLogic Admitto\n104499”,group=a]
}
{rank=same;r1;104499}
subgraph Database {style=filled;fillcolor=khaki3
node [style=filled,fillcolor=khaki3]
graph [label=“Databases”,fontsize=18]
}
subgraph Server {style=filled;fillcolor=lightsteelblue1
node [style=filled,fillcolor=lightsteelblue1]
graph [label=“Servers”,fontsize=18]
“102260” [label=“Admittop Pool\n102260”,group=a]
“102408” [label=“admittop1\n102408”,group=a]
“102409” [label=“admittop2\n102409”,group=a]
}
{rank=same;r2;102260}
{rank=same;r3;102408;102409}
subgraph iService {style=filled;fillcolor=lightsteelblue2
node [style=filled,fillcolor=lightsteelblue2]
graph [label=“Infrastructure Services”,fontsize=18]
}
subgraph cm {style=filled;fillcolor=lightsteelblue
node [style=filled,fillcolor=lightsteelblue]
graph [label=“Configuration Management”,fontsize=18]
}
subgraph Appliance {style=filled;fillcolor=lightsteelblue3
node [style=filled,fillcolor=lightsteelblue3]
graph [label=“Appliances”,fontsize=18]
}
subgraph Rack {style=filled;fillcolor=lightyellow3
node [style=filled,fillcolor=lightyellow3]
graph [label=“Racks”,fontsize=18]
}
subgraph Power {style=filled;fillcolor=snow3
node [style=filled,fillcolor=snow3]
graph [label=“Power”,fontsize=18]
}
“104499” → “102260”
“102260” → “102408”
“102260” → “102409”
}}
Note how the diagram is on the left side. Most diagrams don’t do this. I noticed that if I comment out the three edges at the bottom of above code, I get this:
[dot]
digraph “Admitto”{
splines=ortho
layout=dot
newrank=true
node [shape=none,fontsize=12]
graph [label=“2024-11-07 15:09:38-0500”,labelloc=b,fontsize=7]
subgraph clusterall {graph [label=“Admitto (Database Middleware & ERP Support (DBA)/103666)”,labelloc=t,fontsize=25,color=transparent]
edge [penwidth=1.0,arrowsize=0.5]
subgraph clusterranks{label=“”;margin=0
edge [color=transparent]
node [fontcolor=transparent,fontsize=0,width=0.01,fixedsize=true,label=“”,margin=“0,0”]
r0 → r1 → r2 → r3}
subgraph clusterkey { color=black
graph [label=“Archtitectural layer color key”,fontsize=12]
edge [color=transparent]
node [fontsize=12]
Servicekey [label=“Service”,style=filled,fillcolor=lightgoldenrodyellow]
Appkey [label=“App”,style=filled,fillcolor=khaki1]
MiddleTierkey [label=“MiddleTier”,style=filled,fillcolor=khaki2]
Databasekey [label=“Database”,style=filled,fillcolor=khaki3]
Serverkey [label=“Server”,style=filled,fillcolor=lightsteelblue1]
“Infrastructure Servicekey” [label=“Infrastructure Service”,style=filled,fillcolor=lightsteelblue2]
“Configuration Managementkey” [label=“Configuration Management”,style=filled,fillcolor=lightsteelblue]
Appliancekey [label=“Appliance”,style=filled,fillcolor=lightsteelblue3]
Rackkey [label=“Rack”,style=filled,fillcolor=lightyellow3]
Powerkey [label=“Power”,style=filled,fillcolor=snow3]
{rank=same;r0;Servicekey;Appkey;MiddleTierkey;Databasekey;Serverkey;“Infrastructure Servicekey”;“Configuration Managementkey”;Appliancekey;Rackkey;Powerkey}
Servicekey → Appkey → MiddleTierkey → Databasekey → Serverkey → “Infrastructure Servicekey” → “Configuration Managementkey” → Appliancekey → Rackkey → Powerkey}
subgraph Service {style=filled;fillcolor=lightgoldenrodyellow
node [style=filled,fillcolor=lightgoldenrodyellow]
graph [label=“Services”,fontsize=18]
}
subgraph App {style=filled;fillcolor=khaki1
node [style=filled,fillcolor=khaki1]
graph [label=“Applications”,fontsize=18]
}
subgraph Middle {style=filled;fillcolor=khaki2
node [style=filled,fillcolor=khaki2]
graph [label=“Middle Tier”,fontsize=18]
“104499” [label=“WebLogic Admitto\n104499”,group=a]
}
{rank=same;r1;104499}
subgraph Database {style=filled;fillcolor=khaki3
node [style=filled,fillcolor=khaki3]
graph [label=“Databases”,fontsize=18]
}
subgraph Server {style=filled;fillcolor=lightsteelblue1
node [style=filled,fillcolor=lightsteelblue1]
graph [label=“Servers”,fontsize=18]
“102260” [label=“Admittop Pool\n102260”,group=a]
“102408” [label=“admittop1\n102408”,group=a]
“102409” [label=“admittop2\n102409”,group=a]
}
{rank=same;r2;102260}
{rank=same;r3;102408;102409}
subgraph iService {style=filled;fillcolor=lightsteelblue2
node [style=filled,fillcolor=lightsteelblue2]
graph [label=“Infrastructure Services”,fontsize=18]
}
subgraph cm {style=filled;fillcolor=lightsteelblue
node [style=filled,fillcolor=lightsteelblue]
graph [label=“Configuration Management”,fontsize=18]
}
subgraph Appliance {style=filled;fillcolor=lightsteelblue3
node [style=filled,fillcolor=lightsteelblue3]
graph [label=“Appliances”,fontsize=18]
}
subgraph Rack {style=filled;fillcolor=lightyellow3
node [style=filled,fillcolor=lightyellow3]
graph [label=“Racks”,fontsize=18]
}
subgraph Power {style=filled;fillcolor=snow3
node [style=filled,fillcolor=snow3]
graph [label=“Power”,fontsize=18]
}
#“104499” → “102260”
#“102260” → “102408”
#“102260” → “102409”
}}
[/dot]
Now the nodes have moved toward the center. Why would adding the three edges cause the graph to move to the left? This is the behavior also in the online visual editor. For development I’m running on a Linux system:
$ dot -V
dot - graphviz version 2.43.0 (0)
Obviously I’m not trying to specifically fix this diagram through manual manipulation since the GraphViz code is generated by the CM system, but rather, I need to understand this behavior so I can try to generate better GraphViz code.
Thanks very much for your expertise.