graph g { splines=false; node [ shape="circle" ]; { rank="same"; A; B; } { rank="same"; C; D; } A -- B [ label="1" ]; A -- C [ label="2" ]; A -- D [ label="3" ]; B -- D [ label="2" ]; }