# Drawing directed hyperedges with TikZ

I'm currently working with modelchecking of symbolic dependecy graphs for my semester project in Computer Science, and am dire need of an easy way to draw dependency graphs preferably using TikZ.

My problem is somewhat related to this, but i need the arcs to be directed.

A hyperedge e is a tuple e = (v, T) where v is a source node and T is the target set. Each element in T is a tuple t = (w, t) where w is either a non-negative integer or a parameter and t is a target node.

The follwing example (found here) does exactly what i need, except i need the arcs to be directed.

\documentclass{standalone}
\usepackage{tikz}

\newcommand{\hyperedge}[4][180]{
\draw (#2.#1) ++(#1:.5)  edge (#2) edge (#3) edge (#4);
}

\begin{document}
\begin{tikzpicture}[
y=.7cm, x=1cm,
every edge/.append style={thick}
]

\node (c) at (0,0) {c};
\node (a) at (1,1) {d};
\node (b) at (1,-1) {e};

\hyperedge[0]{c}{b}{a}
\end{tikzpicture}
\end{document}


I tried adding -> as an option to the tikzpicture, but this resulted in arrows not just to the target set but also to the source node.

• every edge/.append style={thick,->}? – Torbjørn T. Mar 17 '14 at 12:48
• @TorbjørnT. Same result as adding -> as an option to tikzpicture. It produces arrows pointing towards either ends of the hyperedge, i.e. also procuces an arrow pointing towards the source node. – AcId Mar 17 '14 at 12:51
• I see, sorry. Do you need to do anything more complex, or is the defined \hypergraph command sufficient? Graph drawing isn't my forte, but for this specific case you could modify the \draw command in the definition of \hypergraph to \draw (#2.#1) ++(#1:.5) edge (#2) edge[->] (#3) edge[->] (#4);. I can add an answer if that is good enough. – Torbjørn T. Mar 17 '14 at 13:00
• @TorbjørnT. THANK YOU! That was exactly what i needed :) PLease add an answer so I can accept it. – AcId Mar 17 '14 at 13:33

For this specific case you can modify the \hypergraph command to read

\newcommand{\hyperedge}[4][180]{
\draw (#2.#1) ++(#1:.5)  edge (#2) edge[->] (#3) edge[->] (#4);
}


which will add arrows to two of the edges, those leading to the target nodes.

\documentclass{standalone}
\usepackage{tikz}

\newcommand{\hyperedge}[4][180]{
\draw (#2.#1) ++(#1:.5)  edge (#2) edge[->] (#3) edge[->] (#4);
}

\begin{document}
\begin{tikzpicture}[
y=.7cm, x=1cm,
every edge/.append style={thick}
]

\node (c) at (0,0) {c};
\node (a) at (1,1) {d};
\node (b) at (1,-1) {e};

\hyperedge[0]{c}{b}{a}
\end{tikzpicture}
\end{document}