3

Via utilizing Tikz, I would like to create a graph such as the following :

graph

So I would like to have a classical directed graph, where there is some text in each node. Moreover there is a single frame associated to each node, and the frame is filled with a bunch of bullet points.

Additionally, three optional but desired properties:

  • Nodes all being the same size. It would also be great if they could hold the text inside of them properly, thus nodes size being adjusted wrt. the node with the largest text.

  • Being able to the frame at the desired position of node (See difference between A,C versus B in graph). A set of options like up,down,left,right and the pairwise combinations could suffice instead of coordinates-wise placement.

  • Frame size being adjusted wrt. number of bullet points(See varying frame sizes from the graph).

With my current knowledge I'm only able to create the generic directed graph consisting of the nodes and the edges. I will try to figure how to achieve all these(assuming there's a way) by reading documentation, however I would highly appreciate if someone can lend a hand.

  • 1
    Welcome to TeX.SX! You might get help more quickly if you post a minimal working example (MWE) showing what you've been able to complete so far. Then the community doesn't have to start from scratch and can focus specifically on the areas that are giving you the most trouble. – Paul Gessler Mar 7 '14 at 4:22
7

A couple of styles and you're good to go:

\documentclass{article}
\usepackage{enumitem}
\usepackage{tikz}
\usetikzlibrary{positioning}

\newlist{tikzitem}{itemize}{1}
\setlist[tikzitem,1]{label=$\bullet$,nolistsep,leftmargin=*}

\begin{document}

\begin{tikzpicture}[
mynode/.style={
  circle,
  draw,
  fill=yellow,
  minimum size=1cm,
  align=center
  },
frame/.style={
  draw=cyan,
  line width=3pt,
  text width=2cm,
  rounded corners
  },
ar/.style={
  ->,
  >=latex
  }    
]
\node[mynode] (a) {Some text};
\node[mynode,below right=2cm and 6cm of a]  (c) {Some text};
\node[mynode,below left=2cm and 6cm of c]  (b) {Some text};

\node[frame,anchor=north west] at (a.-90) 
  {%
  \begin{tikzitem} 
  \item First.
  \item Second.
  \item Third.
  \end{tikzitem}%
  };
\node[frame,anchor=south west] at (b.90) 
  {%
  \begin{tikzitem} 
  \item First.
  \item Second.
  \item Third.
  \end{tikzitem}%
  };
\node[frame,anchor=west] at (c.0) 
  {%
  \begin{tikzitem} 
  \item First.
  \item Second.
  \item Third.
  \item Fourth.
  \item Fifth.
  \end{tikzitem}%
  };

\draw[ar] (a) to[bend left] (c);  
\draw[ar] (b) to[bend right] (c);  
\end{tikzpicture}

\end{document}

enter image description here

The position of the frames with respect to the circles can be controlled using the at (<name>.<angle>) syntax and the appropriate anchors for the frames.

I used the enumitem package to have a customized version of itemize with no extra vertical spacing and no left margin.

  • Thank you so much, works like a charm. There are some more minor stuff that I'm after but I think I'll be able to figure out by myself by inspecting your code. If not, I'll kindly ask again. – alexT Mar 7 '14 at 4:20

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.