帮忙处理一张 tikz 图片

帮忙处理一张 tikz 图片

我正在尝试创建类似下图的东西,这是我目前拥有的代码,但它不会呈现,我不确定我哪里错了。

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}

\begin{tikzpicture}[
  vertex/.style = {shape=circle,draw,minimum size=2em},
  edge/.style = {->,-Latex},
  ]
  % Vertices
  \node[vertex] (c) at (0,0) {6};
  \node[vertex] (a) at (-2,-2) {};
  \node[vertex] (b) at (2,-2) {};
  \node[vertex] (d) at (0,-3) {6};
  \node[vertex] (e) at (-1,-5) {?};
  \node[vertex] (f) at (1,-5 {?};
  \node[vertex] (g) at (-2,-7) {};
  \node[vertex] (h) at (0,-7) {5};
  \node[vertex] (i) at (2,-7) {};
  \node[vertex] (bx) at (0,-9) {5};
  % Edges
  \draw[edge, ultra thick] (a) -- (c) node[midway,left] {$\times$}  ;
  \draw[edge, ultra thick] (b) -- (c) node[midway,right] {$\times$} ;
  \draw[edge, ultra thick] (g) -- (bx) node[midway,left] {$\+$}  ;
  \draw[edge, ultra thick] (I) -- (bx) node[midway,right] {$\+$} ;
  \draw[edge, ultra thick] (a) -- (i) node[midway,left] {}  ;
  \draw[edge, ultra thick] (b) -- (g) node[midway,right] {} ;
 \end{tikzpicture}
\end{document}

交错

答案1

只有几个错别字:我们都去过那里......

在此处输入图片描述

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}

\begin{tikzpicture}[
  vertex/.style = {shape=circle,draw,minimum size=2em},
  edge/.style = {->,-Latex},
  ]
  % Vertices
  \node[vertex] (c) at (0,0) {6};
  \node[vertex] (a) at (-2,-2) {};
  \node[vertex] (b) at (2,-2) {};
  \node[vertex] (d) at (0,-3) {6};
  \node[vertex] (e) at (-1,-5) {?};
  \node[vertex] (f) at (1,-5) {?};% missed )
  \node[vertex] (g) at (-2,-7) {};
  \node[vertex] (h) at (0,-7) {5};
  \node[vertex] (i) at (2,-7) {};
  \node[vertex] (bx) at (0,-9) {5};
  % Edges
  \draw[edge, ultra thick] (a) -- (c) node[midway,left] {$\times$}  ;
  \draw[edge, ultra thick] (b) -- (c) node[midway,right] {$\times$} ;
  \draw[edge, ultra thick] (g) -- (bx) node[midway,left] {$+$}  ;% blocking \
  \draw[edge, ultra thick] (i) -- (bx) node[midway,right] {$+$} ;% i, not I; blocking \
  \draw[edge, ultra thick] (a) -- (i) node[midway,left] {}  ;
  \draw[edge, ultra thick] (b) -- (g) node[midway,right] {} ;
 \end{tikzpicture}
\end{document}

相关内容