Skip to content

tkz-graph examples

Eulerian path

Eulerian path
View TeX code
% euler.tex -- the "open envelope": can it be drawn without lifting the
% pen?  Lua (option lua, Hierholzer's algorithm) finds an Eulerian path
% and the edges are numbered in the order of the path.
% Engine : LuaLaTeX
\documentclass[border=3mm]{standalone}
\usepackage[lua]{tkz-graph}
\begin{document}
\begin{tikzpicture}
  \GraphInit[vstyle=Normal]
  \Vertex[x=0,y=0]{A} \Vertex[x=4,y=0]{B}
  \Vertex[x=4,y=4]{C} \Vertex[x=0,y=4]{D}
  \Vertex[x=2,y=6.5]{E}
  \Edges(A,B,C,D,A) \Edges(A,C) \Edges(B,D) \Edges(D,E,C)
  \tkzGraphEuler[numbers,pos=.3]
  \node[align=center] at (2,-1.4)
    {Eulerian \tkzGraphEulerType, odd vertices \tkzGraphOddVertices\\
     \tkzGraphEulerPath};
\end{tikzpicture}
\end{document}