如何在此模板中垂直添加顶点(或使用 tkz-graph )

如何在此模板中垂直添加顶点(或使用 tkz-graph )

请帮我在 Latex 中画一个这样的图表(见手绘图)?我找到了一个模板其中有干净的乳胶。我试图垂直添加一些顶点,但没有成功,这里是什么我目前有。这就是我想要实现的。这个模板不是必需的。在此处输入图片描述


答案1

欢迎来到 TeX.SE!方向\WE\SO等代表westsouth等。这允许您根据需要进行垂直和水平连接。

\documentclass[border=10pt]{standalone} 
%%%<
\usepackage{verbatim}
%%%>
\begin{comment}
:Title: Drawing a graph
:Tags: Graphs;Computer Science
:Author: Stefan Kottwitz
:Slug: graph

In graph theory, models and drawings often consists mostly
of vertices, edges, and labels. So, it may be possible,
to use a simpler language for generating a diagram of a graph.

The tkz-graph package offers a convenient interface.

The code is fully explained in the LaTeX Cookbook, Chapter 11,
Science and Technology, Application in graph theory.
\end{comment}
\usepackage{tkz-graph}
\GraphInit[vstyle = Shade]
\tikzset{
  LabelStyle/.style = { rectangle, rounded corners, draw,
                        minimum width = 2em, fill = yellow!50,
                        text = red, font = \bfseries },
  VertexStyle/.append style = { inner sep=5pt,
                                font = \Large\bfseries},
%  EdgeStyle/.append style = { bend left} 
  }
\thispagestyle{empty}
\begin{document}
\begin{tikzpicture}
  \SetGraphUnit{3.5}
  \Vertex{A}
  \EA(A){B}
  \EA(B){C}
  \EA(C){D}
  \EA(D){E}
  \SO(A){F}
  \SO(B){G}
  \SO(D){H}
  \SO(E){I}

  \Edge[label = 1](A)(B)
  \Edge[label = 2](B)(C)
  \Edge[label = 3](C)(D)
  \Edge[label = 4](D)(E)

  \Edge[label = 5](A)(F)
  \Edge[label = 6](B)(G)
  \Edge[label = 7](D)(H)
  \Edge[label = 8](E)(I)

  \Edge[label = 9](F)(G)
  \Edge[label = 10](H)(I)

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容