# Force edges to point upwards

**URL:** <https://forum.graphviz.org/t/force-edges-to-point-upwards/2372>\
**Category:** Uncategorized\
**Created:** [July 31, 2024, 8:33am UTC](https://forum.graphviz.org/t/force-edges-to-point-upwards/2372 "2024-07-31T08:33:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nwl](https://avatars.discourse-cdn.com/v4/letter/n/45deac/32.png) [@nwl](https://forum.graphviz.org/u/nwl)\
**Post date:** [July 31, 2024, 8:33am UTC](https://forum.graphviz.org/t/force-edges-to-point-upwards/2372/1 "2024-07-31T08:33:20Z")

</div>

Hi all,

I would like to ask if it is possible to set only the y position of the purple guide nodes to y=0 without specifying the x position such that the nodes will arrange themselves at the most suitable position at y=0 for edges to point upwards and end at the top boundary of the graph like the yellow edges in the third picture.

I am currently using neato and the positions of all the nodes (including the red rectangular nodes) excluding the purple point nodes are fixed, but the graph does not arrange nodes at the top despite using cluster and group as seen in the first and second picture.

 ![image](https://global.discourse-cdn.com/graphviz/original/2X/5/595bb0708b9809dd128f6ad6ecfad0bdeb01925c.png)  
 ![image](https://global.discourse-cdn.com/graphviz/original/2X/d/d35598989209dd8dac3c405a0075fc12303fad74.png)

 ![image](https://global.discourse-cdn.com/graphviz/original/2X/0/01182b58634e3192b934fcba621e734d7b52ec72.png)

Thanks.

---

<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:** [July 31, 2024, 1:57pm UTC](https://forum.graphviz.org/t/force-edges-to-point-upwards/2372/2 "2024-07-31T13:57:24Z")

</div>

- Sorry, no. You need to supply both coordinates.

- **neato** does not do any useful node positioning in the **-n** mode

- **neato** does not do clusters correctly.

- My intuition is that **dot** would be the best engine to start with. Your graphs show (to me) obvious ranking (rows). And then follow that with python, gvpr, or C (or language of your choice) to adjust the **dot** output. (I remember you want top-alignment of you nodes. pretty easy with post-processing).

- if you try using **dot** or **osage** , you can add your own attributes to the objects (e.g. node22 [shape=rect type=midsized team=bears]. The Graphviz engines will ignore these added attributes, but will pass them on to your clean-up code.

---

<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:** [July 31, 2024, 7:13pm UTC](https://forum.graphviz.org/t/force-edges-to-point-upwards/2372/3 "2024-07-31T19:13:56Z")

</div>

[Second attempt to produce a helpful answer.]  
How to get the purple nodes added, well positioned, and connected by well-drawn edges:

- start over with **dot** or **osage**! A lot of work, but maybe worth it if you are going for a repeatable result.
- create a second **dot** graph, just containing the purple nodes. Then try using **gvpack** to glue the two together. This might work. If so, it might go pretty easily. (or maybe not). If it does work, it might be a method of building the entire graph from multiple slices. Edges might be a killer problem. (lots of _might_ here)
- write a **gvpr** or **python** post-processor to add & position the purple nodes and then let **neato -n** or **neato -n2** do the edge routing. If you added your own _pseudo_ attributes to the _red_ nodes, this scheme would probably be fairly easy. (maybe)
