I'm trying to make two graphs and place them side by side and place edge labels over edges in the two graphs (as can be seen in the picture), but I am not successful in the second graph. My approach is to create two nodes in one tikzpicture nad place another two tikzpictures (the graphs itself) in these nodes. Here is my code:
\documentclass[12pt,a4paper]{article}
\usepackage[czech]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,shadows,arrows,decorations.pathreplacing, snakes}
\begin{document}
\begin{tikzpicture}
\tikzstyle{every node}=[circle, minimum size=0pt, inner sep=0pt, outer sep=0pt, fill=white],
\tikzstyle{vertex}=[circle, minimum size=4pt, inner sep=0pt, fill=orange]
\node(graph) at (0,1) {
\begin{tikzpicture}[font=\footnotesize, thick]
\begin{scope}
\node[vertex] (root) at (4, 5) {};
\node[vertex] (o) at (4, 4) {};
\node[vertex] (oc) at (4, 3) {};
\node[vertex] (a) at (5, 4) {};
\foreach \xfrom/\xto/\xlabel in {
root/o/o, o/oc/c,
root/a/a} {
\draw (\xfrom) to node[pos=0.5]{\xlabel} (\xto);
};
\end{scope}
\end{tikzpicture}
};
\node[right = of graph] (graph2) {
\begin{tikzpicture}[font=\footnotesize, thick]
\begin{scope}
\node[vertex] (root) at (4, 5) {};
\node[vertex] (o) at (4, 4) {};
\node[vertex] (oc) at (4, 3) {};
\node[vertex] (a) at (5, 4) {};
\foreach \xfrom/\xto/\xlabel in {
root/o/o, o/oc/c}
{
\draw (\xfrom) to node[pos=0.5]{\xlabel} (\xto);
};
\foreach \xfrom/\xto/\xlabel in {
root/a/a}
{
\draw (\xfrom) to node[midway]{\xlabel} (\xto);
};
\end{scope}
\end{tikzpicture}
};
\end{tikzpicture}
\end{document}
What am I doing wrong or what am I missing? I would appreciate any suggestions. (I need to do it this way because of exact positioning of the graphs and because of additional arrows that will connect these graphs.)
EDIT: Actually, I need to make an arrow between the two graphs:
\documentclass[12pt,a4paper]{article}
\usepackage[czech]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,shadows,arrows,decorations.pathreplacing, snakes}
\begin{document}
\begin{tikzpicture}
\tikzstyle{every node}=[circle, minimum size=0pt, inner sep=0pt, outer sep=0pt, fill=white],
\tikzstyle{vertex}=[circle, minimum size=4pt, inner sep=0pt, fill=orange]
\node(graph) at (0,1) {
\begin{tikzpicture}[font=\footnotesize, thick]
\begin{scope}
\node[vertex] (root) at (4, 5) {};
\node[vertex] (o) at (4, 4) {};
\node[vertex] (oc) at (4, 3) {};
\node[vertex] (a) at (5, 4) {};
\foreach \xfrom/\xto/\xlabel in {
root/o/o, o/oc/c,
root/a/a} {
\draw (\xfrom) to node[pos=0.5]{\xlabel} (\xto);
};
\end{scope}
\end{tikzpicture}
};
\node[right = of graph] (graph2) {
\begin{tikzpicture}[font=\footnotesize, thick]
\begin{scope}
\node[vertex] (root) at (4, 5) {};
\node[vertex] (o) at (4, 4) {};
\node[vertex] (oc) at (4, 3) {};
\node[vertex] (a) at (5, 4) {};
\foreach \xfrom/\xto/\xlabel in {
root/o/o, o/oc/c}
{
\draw (\xfrom) to node[pos=0.5]{\xlabel} (\xto);
};
\foreach \xfrom/\xto/\xlabel in {
root/a/a}
{
\draw (\xfrom) to node[midway]{\xlabel} (\xto);
};
\end{scope}
\end{tikzpicture}
};
\begin{scope}[segment amplitude=4]
\draw[snake=triangles] (graph) -- (graph2);
\end{scope}
\end{tikzpicture}
\end{document}




tikzpictureenvironments. – May 03 '18 at 18:15picsyntax, but since this is too long for a comment I posted an answer. – May 03 '18 at 18:25