Skip to content

Instantly share code, notes, and snippets.

@sitano
Last active May 1, 2020 15:49
Show Gist options
  • Save sitano/5def4e63c418f904ac74ebc6cc87da6d to your computer and use it in GitHub Desktop.
Save sitano/5def4e63c418f904ac74ebc6cc87da6d to your computer and use it in GitHub Desktop.
Updated tkz-berge.tex that works
% https://arxiv.org/pdf/1709.06005.pdf
% https://arxiv.org/pdf/1709.06005.pdf
% https://graphtheoryinlatex.wordpress.com/2011/10/17/options-for-vertices/
% The tkz-berge graph package
% Author: Alain Matthes (http://altermundus.fr/)
% Fixes: @JohnKoepi
\documentclass[]{article}
\usepackage{tikz}
\usepackage{tikz,fullpage}
\usetikzlibrary{arrows,%
petri,%
topaths}%
\usepackage{tkz-berge}
\usepackage[position=top]{subfig}
\usepackage{verbatim}
\begin{comment}
:Title: The tkz-berge graph package
:Slug: tkz-berge
:Tags: Graphs
The ``tkz-berge`` package is a set of convenient macros for drawing typical textbook graphs.
It is built on top of TikZ' node and edge constructs, but adds several shortcuts for placing,
arranging and connecting vertices. Visit the package's home page to see more_ examples_.
Documentation_ only available in French. However, the code and the numerous examples speak for themselves.
:Download: `tkz-berge.sty`_
:Author: `Alain Matthes`_
:Source: `Altermundus`_
:Fixes: `Ivan Prisyazhnyy`_
.. _Alain Matthes: http://altermundus.fr/index.html
.. _Altermundus: http://www.altermundus.fr/pages/pdflatex/graph.html
.. _more: http://www.altermundus.fr/pages/pdflatex/graph.html
.. _examples: http://www.altermundus.fr/pages/math/graphtheory.html
.. _Documentation: http://www.altermundus.fr/pages/downloads/doc-TKZberge.pdf
.. _tkz-berge.sty: http://www.altermundus.fr/pages/downloads/tkz-berge.sty
\end{comment}
\begin{document}
\begin{figure}
\centering
\subfloat[]{
\begin{tikzpicture}[scale=0.75,transform shape]
\Vertex[x=0,y=0]{K}
\Vertex[x=0,y=2]{F}
\Vertex[x=-1,y=4]{D}
\Vertex[x=3,y=7]{H}
\Vertex[x=8,y=5]{B}
\Vertex[x=9,y=2]{N}
\Vertex[x=5,y=0]{M}
\Vertex[x=3,y=1]{S}
\tikzstyle{LabelStyle}=[fill=white,sloped]
\tikzstyle{EdgeStyle}=[bend left]
\Edges[label=$120$](K, F)
\Edges[label=$650$](H, S)
\Edges[label=$780$](H, M)
\Edges[label=$490$](D, B)
\Edges[label=$600$](D, M)
\Edges[label=$580$](B, M)
\Edges[label=$600$](H, N)
\Edges[label=$490$](F, H)
\tikzstyle{EdgeStyle}=[bend right]
\Edges[label=$630$](S, B)
\Edges[label=$210$](S, N)
\Edges[label=$230$](S, M)
\end{tikzpicture}
}
\subfloat[]{
\begin{tikzpicture}[scale=0.75,transform shape]
\tikzstyle{every node}=[bend angle = 45,%
fill = gray!30]
\SetGraphUnit{2}
\Vertex{P}
\NOEA(P){B}
\SOEA(P){M}
\NOEA(B){D}
\SOEA(B){C}
\SOEA(C){L}
\tikzstyle{EdgeStyle}=[pre and post]
\Edges[label=$4$](P, M)
\Edges[label=$9$](C, M)
\Edges[label=$4$](C, L)
\Edges[label=$5$](C, D)
\Edges[label=$10$](B, M)
\tikzstyle{EdgeStyle}=[pre and post,bend right]
\Edges[label=$11$](L, D)
\tikzstyle{EdgeStyle}=[post]
\Edges[label=$3$](C, B)
\Edges[label=$10$](D, B)
\Edges[label=$10$](L, M)
\Edges[label=$10$](B, P)
\end{tikzpicture}
}
\end{figure}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment