von Bartman » So 22. Jan 2017, 13:42
Diese Abbildung könnte auch eine Gelegenheit für den Einsatz der TikZ-Bibliothek graphs sein:
\documentclass[tikz, border=5pt]{standalone}
\usetikzlibrary{
graphs,% für die zweite und dritte Zeichnung
quotes% nur für die dritte Zeichnung
}
\begin{document}
\begin{tikzpicture}[scale=0.75]
\begin{scope}[nodes={circle,draw}]
\node (5) at (0.5,4.5) {1};
\node (6) at (3.5,4.5) {3};
\node (7) at (1.5,6) {3};
\node (8) at (4.5,6) {1};
\end{scope}
\path [
nodes={font=\footnotesize,inner sep=2pt},
auto=right,
every edge/.style={draw,thick}
]
(5) edge node {1} (6)
(6) edge node {1} (7)
(6) edge node[swap] {1} (8);
\end{tikzpicture}
%
% Graph Variante 1
%
\begin{tikzpicture}[scale=0.75]
\begin{scope}[nodes={circle,draw}]
\node (5) at (0.5,4.5) {1};
\node (6) at (3.5,4.5) {3};
\node (7) at (1.5,6) {3};
\node (8) at (4.5,6) {1};
\end{scope}
\begin{scope}[
nodes={font=\footnotesize,inner sep=2pt},
every edge/.style={draw,thick}
]
\graph [use existing nodes, edge label'=1] {
5 -- 6 -- 7
};
\graph [use existing nodes, edge label=1] {
6 -- 8
};
\end{scope}
\end{tikzpicture}
%
% Graph Variante 2
%
\begin{tikzpicture}[scale=0.75]
\begin{scope}[nodes={circle,draw}]
\node (5) at (0.5,4.5) {1};
\node (6) at (3.5,4.5) {3};
\node (7) at (1.5,6) {3};
\node (8) at (4.5,6) {1};
\end{scope}
\begin{scope}[
nodes={font=\footnotesize,inner sep=2pt},
every edge/.style={draw,thick}
]
\graph[use existing nodes] {
5 -- ["1"'] 6 -- {
7 [> "1"'],
8 [> "1"]
}
};
\end{scope}
\end{tikzpicture}
\end{document}
Diese Abbildung könnte auch eine Gelegenheit für den Einsatz der TikZ-Bibliothek [tt]graphs[/tt] sein:
[code]\documentclass[tikz, border=5pt]{standalone}
\usetikzlibrary{
graphs,% für die zweite und dritte Zeichnung
quotes% nur für die dritte Zeichnung
}
\begin{document}
\begin{tikzpicture}[scale=0.75]
\begin{scope}[nodes={circle,draw}]
\node (5) at (0.5,4.5) {1};
\node (6) at (3.5,4.5) {3};
\node (7) at (1.5,6) {3};
\node (8) at (4.5,6) {1};
\end{scope}
\path [
nodes={font=\footnotesize,inner sep=2pt},
auto=right,
every edge/.style={draw,thick}
]
(5) edge node {1} (6)
(6) edge node {1} (7)
(6) edge node[swap] {1} (8);
\end{tikzpicture}
%
% Graph Variante 1
%
\begin{tikzpicture}[scale=0.75]
\begin{scope}[nodes={circle,draw}]
\node (5) at (0.5,4.5) {1};
\node (6) at (3.5,4.5) {3};
\node (7) at (1.5,6) {3};
\node (8) at (4.5,6) {1};
\end{scope}
\begin{scope}[
nodes={font=\footnotesize,inner sep=2pt},
every edge/.style={draw,thick}
]
\graph [use existing nodes, edge label'=1] {
5 -- 6 -- 7
};
\graph [use existing nodes, edge label=1] {
6 -- 8
};
\end{scope}
\end{tikzpicture}
%
% Graph Variante 2
%
\begin{tikzpicture}[scale=0.75]
\begin{scope}[nodes={circle,draw}]
\node (5) at (0.5,4.5) {1};
\node (6) at (3.5,4.5) {3};
\node (7) at (1.5,6) {3};
\node (8) at (4.5,6) {1};
\end{scope}
\begin{scope}[
nodes={font=\footnotesize,inner sep=2pt},
every edge/.style={draw,thick}
]
\graph[use existing nodes] {
5 -- ["1"'] 6 -- {
7 [> "1"'],
8 [> "1"]
}
};
\end{scope}
\end{tikzpicture}
\end{document}[/code]