Маленький треугольник появляется при смене метки ребра в тикзе - PullRequest
0 голосов
/ 16 июня 2019

Я хочу создать ориентированный граф.Я использую "тикз" -пакет.Когда я компилирую код, создается некоторое ребро размера 0.

При изменении кода на \draw ребро исчезло.

Unwanted triangles

Кодвоспроизвести проблему:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,matrix,arrows.meta}

\begin{document}
\begin{tikzpicture}[>=stealth', shorten >=1pt,
    node distance=2cm, scale=1, font=\scriptsize,
    state/.style={circle, draw, minimum size=0.7cm}]

\node[state] (1) at (0,0) {$s$};
\node[state, above right of=1] (2) {$v_1$};
\node[state, below right of=1] (3) {$v_2$};
\node[state, right of=2] (4) {$v_3$};
\node[state, right of=3] (5) {$v_4$};
\node[state, below right of=4] (6) {$t$};

\path[draw, ->, red, thick] (1.60) edge node [above left] {12} (2.210);
\path[draw, <-] (1.30) edge node [below right] {4} (2.240);

\path[draw, ->] (2.15) edge node [above] {8} (4.165);
\path[draw, <-] (2.345) edge node [below] {4} (4.195);

\path[draw, ->, red, thick] (4.330) edge node [above right] {16} (6.120);
\path[draw, <-] (4.300) edge node [below left] {4} (6.150);

\path[draw, ->] (1.330) edge node [above right] {9} (3.120);
\path[draw, <-] (1.300) edge node [below left] {4} (3.150);

\path[draw, <-, red, thick] (3) edge node [right] {4} (2);

\path[draw, ->] (3.15) edge node [above] {10} (5.165);
\path[draw, <-] (3.345) edge node [below] {4} (5.195);

\path[draw, ->] (5) edge node [below right] {4} (6);
\path[draw, ->] (5) edge node [right] {7} (4);

\path[draw, ->] (4.240) edge node [below right] {5} (3.30);
\path[draw, <-, red, thick] (4.210) edge node [above left] {4} (3.60);

\end{tikzpicture}
\end{document}

1 Ответ

1 голос
/ 21 июня 2019
\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,matrix,arrows.meta}

\begin{document}
\begin{tikzpicture}[>=stealth', shorten >=1pt,
    node distance=2cm, scale=1, font=\scriptsize,
    state/.style={circle, draw, minimum size=0.7cm}]

\node[state] (1) at (0,0) {$s$};
\node[state, above right of=1] (2) {$v_1$};
\node[state, below right of=1] (3) {$v_2$};
\node[state, right of=2] (4) {$v_3$};
\node[state, right of=3] (5) {$v_4$};
\node[state, below right of=4] (6) {$t$};

\path (1.60) edge [->, red, thick] node [above left] {12} (2.210);
\path (1.30) edge [<-] node [below right] {4} (2.240);

\path (2.15) edge [->] node [above] {8} (4.165);
\path (2.345) edge [<-] node [below] {4} (4.195);

\path (4.330) edge [->, red, thick] node [above right] {16} (6.120);
\path (4.300) edge [<-] node [below left] {4} (6.150);

\path (1.330) edge [->] node [above right] {9} (3.120);
\path (1.300) edge [<-] node [below left] {4} (3.150);

\path (3) edge [<-, red, thick] node [right] {4} (2);

\path (3.15) edge [->] node [above] {10} (5.165);
\path (3.345) edge [<-] node [below] {4} (5.195);

\path (5) edge [->] node [below right] {4} (6);
\path (5) edge [->] node [right] {7} (4);

\path (4.240) edge [->] node [below right] {5} (3.30);
\path (4.210) edge  [<-, red, thick] node [above left] {4} (3.60);

\end{tikzpicture}
\end{document}

Direct Graph

...