graph { rankdir=LR { rank=same; 1 [ xlabel="0" ]; 3 [ xlabel="1" ]; } { rank=same; 2 [ xlabel="1" ]; 4 [ xlabel="1" ]; } { rank=same; 5 [ xlabel="2" ]; } 1 -- 2; 1 -- 3; 1 -- 4; 2 -- 5; 4 -- 5; }