I have the following code:

\tikz \graph[grow right sep=20,nodes={draw,rectangle}] { a -> {b, long node name} };

Which produces this output: MWE output: a -> {b, long node name}

I'd like to have the edge "a" -> "long node name" to not go from east to north but from south to west. Is this possible while still using just one \graph call? Or do I need to specify that edge manually in an extra command?

(That is, I have basically the same problem as in the question Edge anchor in tikz, but I want to use TikZ' graph drawing capabilities instead of manually creating edges.)


To obtain west anchor for node long node name you can use right anchor=west.


\tikz \graph[grow right sep=20,nodes={draw,rectangle},right anchor=west] { a -> {b, long node name} };


enter image description here

  • The arrows should go from south to west, though. :) – Alenanno Feb 7 '16 at 11:04

This is what you want, I think. enter image description here

I never used \graph. The natural way I do something like what you asked is using \nodes and anchors, as follows:


    \node[draw] (a) {a};
   \node[draw,anchor=west] (b) at ($(a)+(1cm,0)$) {b};
   \node[draw,anchor=west] (c) at ($(a)+(1cm,-1cm)$) {long node name};
   \draw[->] (a) -- (b);
   \draw[->] (a.south) -- (c.west);

Sure, you have to set a proper distance between the nodes; if not so, the arrow head could intersect the rectangle, but there's no way to avoid this but changing arrow heads. Furthermore, you could use curved arrows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.