Force straight edges above/through a node

Hi all,

I’m trying to write a digraph that would end up generating a graph similar to this SVG: https://try.popho.be/images/haproxy-tls.svg (this was inspired from haproxy’s documentation). At the time, I modified (by hand) the SVG to put straight edges and replace the splines that graphviz put there.

I have tried many things so far: using (at random) other generators instead of dot, splines=line (which is not actually a straight line, but a succession of straight segments).

I want the edges client -> dns.google and client -> cloudflare-dns.com to pass over the haproxy node (much like the TLS edges pass through the haproxy node in the submitted example).

digraph blind_doh_proxy {
  bgcolor=transparent;
/*  splines=line; */
  
  client -> "haproxy" [label="TCP to proxy" color="darkgreen" fontsize="9" fontcolor="darkgreen"]
  client -> "haproxy" [label="TCP to proxy" color="indigo" fontsize="9" fontcolor="indigo"]
  
  "haproxy"  -> "dns.google" [label="TCP to dns.google" color="darkgreen" fontsize="9" fontcolor="darkgreen"]
  "haproxy"  -> "cloudflare-dns.com" [label="TCP to cloudflare-dns.com" color="indigo" fontsize="9" fontcolor="indigo"]
  "haproxy" [weight=10]

  client -> "dns.google" [label="HTTPS to dns.google"]
  client -> "cloudflare-dns.com" [label="HTTPS to cloudflare-dns.com"]

}

It would be (relatively) trivial to hack this.

I also realize now this should be done to try to remediate the situation when the codegen detected “lost U V edge”; at least draw something useful.

add explicit pos values and the run through neato -n
see FAQ | Graphviz

//  use neato -n to produce this graph
//    see https://graphviz.org/faq/#FaqDotWithNodeCoords
digraph blind_doh_proxy {
  bgcolor=transparent;
  splines=false; 
  // pos values were "eyeballed"
  client          [pos="150,200"]
  haproxy         [pos="150,130"]     
  "dns.google"    [pos="75,30"]
  "cloudflare-dns.com"   [pos="240,30"]
  client -> "haproxy" [label="TCP to proxy" color="indigo" fontsize="9" fontcolor="indigo"]
  
  "haproxy"  -> "dns.google" [label="TCP to dns.google" color="darkgreen" fontsize="9" fontcolor="darkgreen"]
  "haproxy"  -> "cloudflare-dns.com" [label="TCP to cloudflare-dns.com" color="indigo" fontsize="9" fontcolor="indigo"]
  "haproxy" [weight=10]

  client -> "dns.google" [label="HTTPS to dns.google"]
  client -> "cloudflare-dns.com" [label="HTTPS to cloudflare-dns.com"]
}

Giving:
straightEdge2

Use splines=line and xlabels instead of labels:

digraph blind_doh_proxy {
  bgcolor=transparent;
  splines=line;

  client -> "haproxy" [xlabel="TCP to proxy"
    color="indigo" fontsize="9" fontcolor="indigo"]

  "haproxy"  -> "dns.google" [xlabel="TCP to dns.google" color="darkgreen" fontsize="9" fontcolor="darkgreen"]
  "haproxy"  -> "cloudflare-dns.com" [xlabel="TCP to cloudflare-dns.com" color="indigo" fontsize="9" fontcolor="indigo"]

  client -> "dns.google" [xlabel="HTTPS to dns.google" ]
  client -> "cloudflare-dns.com" [xlabel="HTTPS to cloudflare-dns.com" ]

}

I also removed the weight attribute on haproxy, as weights only work on edges, and the duplicate client → haproxy edge.

out