# Position of nodes of same rank

**URL:** <https://forum.graphviz.org/t/position-of-nodes-of-same-rank/912>\
**Category:** Help\
**Created:** [November 17, 2021, 2:21pm UTC](https://forum.graphviz.org/t/position-of-nodes-of-same-rank/912 "2021-11-17T14:21:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hilby84](https://avatars.discourse-cdn.com/v4/letter/h/e19b73/32.png) [@hilby84](https://forum.graphviz.org/u/hilby84)\
**Post date:** [November 17, 2021, 2:21pm UTC](https://forum.graphviz.org/t/position-of-nodes-of-same-rank/912/1 "2021-11-17T14:21:41Z")

</div>

Hello, i am doing a graph and I wonder how I can change the position of nodes that are on the same rank. Here is an example:

```auto
graph G{
rankdir = LR;

n0 [shape=Mdiamond]
n1 [color="red", style=filled]
n2
n3
n4
n5
n6
n7
n8
n9
n10
n11
n12
n13
n14

{ rank=source n0 }
ordering="in"
n0 -- n1
n1 -- n2
n2 -- n3
n2 -- n4
n2 -- n5
n5 -- n6 
n6 -- n7
n7 -- n9
n7 -- n8
n9 -- n10
n9 -- n11
n9 -- n12
n12 -- n13
n13 -- n14
}

```

This creates this output:

 ![graphviz](https://global.discourse-cdn.com/graphviz/original/1X/83143570980267ac4c9afba29859101f15eef03a.png)

I want to change the position of node n4/n5 and/or n8/n9. Changing the order in the code does not have any effect.

How can I do that?

Thanks in advance and best regards  
Hilby

---

<div class="post-metadata">

**Author:** ![hilby84](https://avatars.discourse-cdn.com/v4/letter/h/e19b73/32.png) [@hilby84](https://forum.graphviz.org/u/hilby84)\
**Post date:** [November 17, 2021, 4:31pm UTC](https://forum.graphviz.org/t/position-of-nodes-of-same-rank/912/2 "2021-11-17T16:31:30Z")

</div>

Hello everyone, I was able to solve the issue on my own and want to share my solution. The position of the node is determined by the nodelist that is given before defining the graph structure. If there is some other way, feel free to let me know. For now this solved my issue. My New code:

```auto
graph G{
rankdir = LR;

n0 [shape=Mdiamond]
n1 [color="red", style=filled]
n2
n3
n5
n4
n6
n7
n9
n8
n10
n11
n12
n13
n14

{ rank=source n0 }
ordering="in"
n0 -- n1
n1 -- n2
n2 -- n3
n2 -- n4
n2 -- n5
n5 -- n6 
n6 -- n7
n7 -- n9
n7 -- n8
n9 -- n10
n9 -- n11
n9 -- n12
n12 -- n13
n13 -- n14
}

```

creates:

 ![graphviz](https://global.discourse-cdn.com/graphviz/original/1X/08a9b3cd4e458cd085579a31ed8385cd0eab78c0.png)

Best wishes  
Hilby
