This is an example taken directly from the pgf manual:
\pgfmathsetseed{1}
\foreach \col in {black,red,green,blue}
{
\begin{tikzpicture}[x=10pt,y=10pt,ultra thick,baseline,line cap=round]
\coordinate (current point) at (0,0);
\coordinate (old velocity) at (0,0);
\coordinate (new velocity) at (rand,rand);
\foreach \i in {0,1,...,100}
{
\draw[\col!\i] (current point)
.. controls ++([scale=-1]old velocity) and
++(new velocity) .. ++(rand,rand)
coordinate (current point);
\coordinate (old velocity) at (new velocity);
\coordinate (new velocity) at (rand,rand);
}
\end{tikzpicture}
}
It is at the beginning of the Part VI: Mathematical and Object Oriented Engines. The whole section on mathematical engine is what you want to read if you want to do random drawing in tikz.
I'm the author of this package. The good news are the new versions of tkz-graph and tkz-berge will be on the ctan servers this week (i'm working on the docs actually), the bad news are that I modified some macros. I'm not sure to understand exactly what you want but an answer is that you can put TikZ's code inside you code.
Vertices are nodes so you can add multiple labels if you want with the option label=
, if you want adding a text you can use the option text width
something like :
\SO(P){X1}
\node[text width=2cm,left=1cm] (X1){the protocol starts here};
Another possibility :
\begin{tikzpicture}
{ \SetVertexNoLabel
\Vertex[style={label=60:A}]{A}}
\SO[Lpos=180,
LabelOut,
L= {the protocol starts here},
style={text width=2cm}](A){B}
\end{tikzpicture}
But there are other ways to do this. You can use label
. In your code you used "position" , it's not very fine because it's a problem to use "scale".
In 12 hours, I will upload the new version of tkz-graph. I the new version node distance
is obsolete, now I added an option unit
and a macro \tkzGraphUnit=6
instead of `\tikzset{node distance=6cm}.
Best Answer
It is -- of course -- posible to draw diagrams like this with TikZ. However, as far as I know there is no automatic placement for things like this.
Once one gets the hang of guessing distances, it is fairly easy to reproduce graph like the example in TikZ:
I think the code is fairly self-explanatory: First the vertice coordinates are specified. Then all the areas are drawn with the help of
curve to
statements. Afterwards the circles and labels are placed. The result isThis is not a perfect copy of the original image. With some more fiddling around with the coordinates and some additional points in the paths one could get closer.