digraph G { rankdir="RL"; node [style=filled,color=grey,shape=circle]; A B C D E; B -> A C -> A D -> B D -> C E -> D A [style=filled,color=grey]; B [style=filled,color=grey]; C [style=filled,color=grey]; D [style=filled,color=grey]; E [style=filled,color=grey]; A -> Am E -> Em subgraph cm { rankdir="BT"; rank="same"; C Cm } C -> Cm subgraph bm { rankdir="TB"; rank="same"; B Bm } B -> Bm subgraph em { rankdir="BT"; rank="same"; E Em } Am [shape=Mdiamond,style=filled,color=lightblue]; Bm [shape=Mdiamond,style=filled,color=lightblue]; Cm [shape=Mdiamond,style=filled,color=lightblue]; Em [shape=Mdiamond,style=filled,color=lightblue]; }