Is there a simple way to achieve this type of graph?

enter image description here

Obviously a lot neater than this... But the important feature is the join between the two children of P.


This solution uses the powerful forest package together with the angles library of PGF/TikZ.

A special style, tree angle is defined which marks the angle between a child node and the next sibling.

The combination allows the tree itself to be specified very concisely:

\usetikzlibrary{arrows.meta, angles}
  tree angle/.style={
    tikz={\path () coordinate (A) -- (!u) coordinate (B) -- (!n) coordinate (C) pic [draw] {angle};}
  for tree={
    l sep+=7.5pt
  [Q, tree angle
      [T, tree angle]
      [W, tree angle]

tree angles in a forest

  • Can you explain the tree angle rule? It doesn't render well for rectangle boxes. – Gqqnbig Jan 25 at 0:50

You should study pgfmanual (v2.10 as of mine) for trees library (sections 18.Making Trees Grow, 53.Tree Library) and placing nodes on a line or curve (sections 16.8 and 16.9).

\begin{tikzpicture}[level distance=1.5cm, grow=down,
    every node/.style={draw, circle, thin},
    edge from parent/.style={-latex, thick, draw}
\node (P) {P}
    child {node (Q) {Q}
        child {node (T) {T}}
        child {node (U) {U}}
    child {node (R) {R}}
    child {node (S) {S}};

\path (P) -- coordinate[midway] (PQ) (Q);
\path (P) -- coordinate[midway] (PR) (R);

\draw (PQ) to[bend right=22] (PR);

Code output

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.