# Forcing edges between two table cells to be straight

**URL:** <https://forum.graphviz.org/t/forcing-edges-between-two-table-cells-to-be-straight/2420>\
**Category:** Help\
**Created:** [August 30, 2024, 10:44pm UTC](https://forum.graphviz.org/t/forcing-edges-between-two-table-cells-to-be-straight/2420 "2024-08-30T22:44:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayaprabhakar](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@jayaprabhakar](https://forum.graphviz.org/u/jayaprabhakar)\
**Post date:** [August 30, 2024, 10:44pm UTC](https://forum.graphviz.org/t/forcing-edges-between-two-table-cells-to-be-straight/2420/1 "2024-08-30T22:44:17Z")

</div>

I am looking to draw binary tree and want it to maintain the node position. When the tree is mostly full (that is all (actually almost) non-leaf nodes have 2 children. So using HTML node type seems to get the best visual. Unfortunately, when adding an edge between the nodes, the edge goes out of the table loops around and comes back to the the head node instead of following the shortest straight route.

`splines=false` or `constraint=false` doesn’t help. adding weight doesn’t help ☹

```auto
digraph {
  splines=false
  tree [shape=plaintext class="fizzbee binarytree" label=<<table cellspacing="16" cellpadding="0" border="0" cellborder="0">
    <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td port="0">0</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
    <tr><td> </td><td> </td><td> </td><td port="1">1</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>2</td><td> </td><td> </td><td> </td></tr>
    <tr><td> </td><td>3</td><td> </td><td> </td><td> </td><td>4</td><td> </td><td> </td><td> </td><td>5</td><td> </td><td> </td><td> </td><td>6</td><td> </td></tr>
    
    <tr><td>7</td><td> </td><td>8</td><td> </td><td>9</td><td> </td><td>10</td><td> </td><td> 11</td><td> </td><td>12</td><td> </td><td>13</td><td> </td><td>14</td></tr>
    
  </table>>]

  tree:0:sw -> tree:1:ne [constraint="false" class="fizzbee binarytree edge" weight="100"]
}

```

Is there a way to force the a straight line between these two cells? Although I could write a javascript code to do that, I want to avoid and would prefer a native way of doing this.

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [August 31, 2024, 7:19pm UTC](https://forum.graphviz.org/t/forcing-edges-between-two-table-cells-to-be-straight/2420/2 "2024-08-31T19:19:16Z")

</div>

Can’t think of any way to force a straight-line edge in this situation - even though **splines=false**. (The other layout engines also produce loopy edges).

---

<div class="post-metadata">

**Author:** ![wieserfalke](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/wieserfalke/32/1473_2.png) [@wieserfalke](https://forum.graphviz.org/u/wieserfalke)\
**Post date:** [September 1, 2024, 6:34pm UTC](https://forum.graphviz.org/t/forcing-edges-between-two-table-cells-to-be-straight/2420/3 "2024-09-01T18:34:12Z")

</div>

This thread could help [Straitening one line throu a table](https://forum.graphviz.org/t/straitening-one-line-throu-a-table/2196)

---

<div class="post-metadata">

**Author:** ![jayaprabhakar](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@jayaprabhakar](https://forum.graphviz.org/u/jayaprabhakar)\
**Post date:** [September 1, 2024, 7:49pm UTC](https://forum.graphviz.org/t/forcing-edges-between-two-table-cells-to-be-straight/2420/4 "2024-09-01T19:49:07Z")

</div>

Thanks. This involves gvpr from my understanding, javascript apis do not support gvpr (I am running this in the browser) and so probably I will have to create custom post processing in javascript to add a direct link.
