So this is what I would like to have (please don't mind my awful paint skills):
And this is what I got out of tikz:
Using this code:
\documentclass{article}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
\tikzstyle{depot}=[circle, draw, fill=red]
\tikzstyle{station}=[circle, draw, fill=green]
\tikzstyle{customer}=[circle, draw, fill=yellow]
\tikzstyle{line}=[draw, -latex']
\begin{tikzpicture}[node distance=2cm]
\node[depot](s) {$s$};
\node[station, right of=s](p1) {$p_1$};
\node[rectangle, draw=black, right of=p1](c1) {\begin{tabular}{c} $c_1$\\\hline $d_1$\\\hline $d_2$ \\\hline $d_3$ \\\hline $\vdots$ \\\hline $d_{m(i)}$\end{tabular}};
\node[station, right of=c1](p2) {$p_2$};
\node[rectangle, draw=black, right of=p2](c2) {\begin{tabular}{c} $c_1$\\\hline $d_1$\\\hline $d_2$ \\\hline $d_3$ \\\hline $\vdots$ \\\hline $d_{m(i)}$\end{tabular}};
\node[depot, right of=c2](t) {$t$};
\draw[thick, ->] (s) -- node[yshift=.2cm] {$t_{sp_1}$} (p1);
\draw[thick, ->] (p1) -- node[yshift=.2cm] {$t_{p_1c_1}$} (c1);
\draw[thick, ->] (c1) -- node[yshift=.2cm] {$t_{c_1p_2}$} (p2);
\draw[thick, ->] (p2) -- node[yshift=.2cm] {$t_{p_2c_2}$} (c2);
\draw[thick, ->] (c2) -- node[yshift=.2cm] {$t_{c_2t}$} (t);
\end{tikzpicture}
\end{document}
As I'm new to tikz, I'm not sure how to resolve the remaining issues:
- The horizontal lines in the table have white space on both sides, and the table is too wide.
- The arrows should point at specific entries in the table, not just to the middle of the table.
- The table colors (color of top cell must be different from remaining cells). Btw, I'm open minded towards a prettier color scheme and a cleaner overall look :).
- If possible, the rounded table top, but that's just bonus.
Any suggestions are highly appreciated.
automata
library. Chapter 19 of the manual, and also a bunch of examples.inner sep=0pt
for the nodes with the table and\begin{tabular}{@{}c@{}}
. 2. Instead of atabular
use therectangle split
shape. It provides west and east anchors for every entry. 3. Userectangle split part fill={blue,blue!80!red}
(for example). 4. Yes, that’s really a little bit harder but can be done withappend after command
orpath picture
and a node that is not drawn. 5. Don’t useyshift=.2cm
for the nodes along the lines butabove
orauto
(see manual).\tikzstyle
andright of
are deprecated.