Re: [graphviz-interest] Graphviz: make invisible node take no space

"Emden R. Gansner" <[email protected]> Wed, 13 Sep 2017 17:53:24 -0400
Newsgroups gmane.comp.video.graphviz
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============1460925505430429004==
Content-Type: multipart/alternative;
 boundary="------------36B428C91C737ADE32391F76"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------36B428C91C737ADE32391F76
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

The node itself is not taking up space; the culprits are the nodesep and 
cluster margin. No matter the size of the node, there will always be 
2*nodesep or
nodesep+margin space around the node. That is built into the dot algorithm.

If you are after cluster edges without having to pick a representative 
node (using ltail/lhead), one could try doing a dot layout without the 
cluster edges, then add invisible nodes representing the cluster and the 
missing cluster edges, and then the graph through neato -n2 -Gsplines. 
Unfortunately, this won't work. If you make the invisible node a point, 
you still need to handle the clipping to the cluster boundary. If you 
make the invisible node a rectangle the size of the cluster, the spline 
routing will fail.

The machinery for handling real compound edges exists in fdp and could 
be exposed to be used in other layouts. For most layouts this would be 
fine, but to do this correctly in dot, one would have to handle compound 
edges during crossing reduction.

     Emden



On 9/13/17 4:08 AM, Chiel ten Brinke wrote:
> Consider the graph
>
>     digraph "Graph b9ca21a1-971e-400c-a7f4-cd650986476a" {
>         graph [ margin=10 ];
>         node [ shape=point ];
>         "Invisible"  [
>             //height=0,
>             //width=0,
>             //margin=0,
>             //style=invis,
>             color="red"
>             ];
>         subgraph "cluster_1" {
>             "A";
>             "B";
>             "Invisible";
>             "C";
>             "D";
>         }
>     }
>
> resulting in
>
> https://i.stack.imgur.com/iF1ax.png
>
> I want the red node to be completely invisible, taking up no space, 
> but it has to remain there, such that it can be used for 
> `lhead`/`ltail` an other such miscellaneous things.
>
> When uncommenting the commented lines, the result is
>
> https://i.stack.imgur.com/jjrp7.png
>
> As you see, there is still a spatial artifact of this node.
>
> Question: is there a way to remove this completely, without affecting 
> the other nodes' layout in the graph?
>
>
> Regards,
>
> Chiel
>
>
> _______________________________________________
> [email protected]
> http://lists.research.att.com/mailman/listinfo/graphviz-interest


--------------36B428C91C737ADE32391F76
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">The node itself is not taking up space;
      the culprits are the nodesep and cluster margin. No matter the
      size of the node, there will always be 2*nodesep or <br>
      nodesep+margin space around the node. That is built into the dot
      algorithm. <br>
      <br>
      If you are after cluster edges without having to pick a
      representative node (using ltail/lhead), one could try doing a dot
      layout without the cluster edges, then add invisible nodes
      representing the cluster and the missing cluster edges, and then
      the graph through neato -n2 -Gsplines. Unfortunately, this won't
      work. If you make the invisible node a point, you still need to
      handle the clipping to the cluster boundary. If you make the
      invisible node a rectangle the size of the cluster, the spline
      routing will fail. <br>
      <br>
      The machinery for handling real compound edges exists in fdp and
      could be exposed to be used in other layouts. For most layouts
      this would be fine, but to do this correctly in dot, one would
      have to handle compound edges during crossing reduction. <br>
      <br>
          Emden<br>
      <br>
      <br>
      <br>
      On 9/13/17 4:08 AM, Chiel ten Brinke wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFw20sz_UTK=az+3zLYdMLhxPCecyP4CaD54sO21UV7XqknbhA@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_default">
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">Consider the graph </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif"><br>
            </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">    digraph "Graph
              b9ca21a1-971e-400c-a7f4-cd650986476a" {</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">        graph [ margin=10 ];</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">        node [ shape=point ];</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">    </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">        "Invisible"  [</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">            //height=0,</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">            //width=0,</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">            //margin=0,</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">            //style=invis,</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">            color="red"</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">            ];</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">    </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">        subgraph "cluster_1" {</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">            "A";</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">            "B";</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">            "Invisible";</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">            "C";</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">            "D";</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">        }</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">    </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">    }</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif"><br>
            </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">resulting in</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif"><br>
            </font></div>
          <div class="gmail_default"><span
              style="font-family:arial,helvetica,sans-serif"><a
                href="https://i.stack.imgur.com/iF1ax.png"
                moz-do-not-send="true">https://i.stack.imgur.com/iF1ax.png</a></span><br>
          </div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif"><br>
            </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">I want the red node to be completely
              invisible, taking up no space, but it has to remain there,
              such that it can be used for `lhead`/`ltail` an other such
              miscellaneous things.</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif"><br>
            </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">When uncommenting the commented lines, the
              result is</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif"><br>
            </font></div>
          <div class="gmail_default"><span
              style="font-family:arial,helvetica,sans-serif"><a
                href="https://i.stack.imgur.com/jjrp7.png"
                moz-do-not-send="true">https://i.stack.imgur.com/jjrp7.png</a></span><br>
          </div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif"><br>
            </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">As you see, there is still a spatial artifact
              of this node.</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif"><br>
            </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif">Question: is there a way to remove this
              completely, without affecting the other nodes' layout in
              the graph?</font></div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default">Regards,</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default">Chiel</div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="http://lists.research.att.com/mailman/listinfo/graphviz-interest">http://lists.research.att.com/mailman/listinfo/graphviz-interest</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>

--------------36B428C91C737ADE32391F76--

--===============1460925505430429004==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
[email protected]
http://lists.research.att.com/mailman/listinfo/graphviz-interest

--===============1460925505430429004==--