1

Please help me draw a graph like this(see hand-drawing pic) in Latex ? I have found a template which has clean Latex in it. I am trying to add some vertices vertically without any success, Here is what I have so far. This is what I am trying to achieve. It is not necessary to this template. enter image description here


1

Welcome to TeX.SE! The directions \WE, \SO etc. stand for west, south etc. This allows you to do vertical and horizontal connections as you like.

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.