2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00
This commit is contained in:
Martin Thoma 2013-06-29 10:14:22 +02:00
parent 3cfc9d9969
commit 86ab5dfa97
16 changed files with 212 additions and 136 deletions

View file

@ -31,6 +31,7 @@ Kantenmenge bezeichnet.
\framedgraphic{Modellierung, Flüsse, Netzwerke}{../images/Unit_disk_graph.png}
\framedgraphic{Karten}{../images/map.png}
\framedgraphic{Good Will Hunting}{../images/good-will-hunting.jpg}
\framedgraphic{Graham's Number}{../images/hypercube.png}
\begin{frame}{Isomorphe Graphen}
\begin{center}

View file

@ -1,7 +0,0 @@
SOURCE = Plan
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.out

View file

@ -1,121 +0,0 @@
\documentclass[a4paper,9pt]{scrartcl}
\usepackage{amssymb, amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage[margin=2.5cm]{geometry} %layout
\usepackage{hyperref} % links im text
\usepackage{color}
\usepackage{framed}
\usepackage{enumerate} % for advanced numbering of lists
\clubpenalty = 10000 % Schusterjungen verhindern
\widowpenalty = 10000 % Hurenkinder verhindern
\hypersetup{
pdfauthor = {Martin Thoma},
pdfkeywords = {Diskrete Mathematik},
pdftitle = {Vortrag Graphentheorie I: Tafelbild + Text}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Custom definition style, by %
% http://mathoverflow.net/questions/46583/what-is-a-satisfactory-way-to-format-definitions-in-latex/58164#58164
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\newdimen\errorsize \errorsize=0.2pt
% Frame with a label at top
\newcommand\LabFrame[2]{%
\fboxrule=\FrameRule
\fboxsep=-\errorsize
\textcolor{FrameColor}{%
\fbox{%
\vbox{\nobreak
\advance\FrameSep\errorsize
\begingroup
\advance\baselineskip\FrameSep
\hrule height \baselineskip
\nobreak
\vskip-\baselineskip
\endgroup
\vskip 0.5\FrameSep
\hbox{\hskip\FrameSep \strut
\textcolor{TitleColor}{\textbf{#1}}}%
\nobreak \nointerlineskip
\vskip 1.3\FrameSep
\hbox{\hskip\FrameSep
{\normalcolor#2}%
\hskip\FrameSep}%
\vskip\FrameSep
}}%
}}
\definecolor{FrameColor}{rgb}{0.25,0.25,1.0}
\definecolor{TitleColor}{rgb}{1.0,1.0,1.0}
\newenvironment{contlabelframe}[2][\Frame@Lab\ (cont.)]{%
% Optional continuation label defaults to the first label plus
\def\Frame@Lab{#2}%
\def\FrameCommand{\LabFrame{#2}}%
\def\FirstFrameCommand{\LabFrame{#2}}%
\def\MidFrameCommand{\LabFrame{#1}}%
\def\LastFrameCommand{\LabFrame{#1}}%
\MakeFramed{\advance\hsize-\width \FrameRestore}
}{\endMakeFramed}
\newcounter{definition}
\newenvironment{definition}[1]{%
\par
\refstepcounter{definition}%
\begin{contlabelframe}{Definition \thedefinition:\quad #1}
\noindent\ignorespaces}
{\end{contlabelframe}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Begin document %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\section{Königsberger Brückenproblem}
\subsection{Beweis des Satzes von Euler}
Tafelbild:
Sie $G = (E, K)$ ein eulerscher Graph, $K$ ein Eulerkreis durch $G$ und
$e \in E$ eine beliebige Kante.
Dann geht $K$ durch $e$. Nun sei $a$ die Anzahl, wie häufig $K$ durch $e$ geht.
Offensichtlich geht der Kreis sowohl in den Knoten hinein, als auch hinaus.
$\Rightarrow e$ hat mindestens den Knotengrad $2a$. Es kann keine weitere
Kante geben, da jeder Eulerkreis zu $G$ alle Kanten von $G$ beinhaltet.
$\Rightarrow e$ hat den Knotengrad $2a \Rightarrow$ Jede Ecke von $G$ hat geraden
Grad. $\blacksquare$
\subsection{Rückrichtung}
Hat jede Ecke in einem zusammenhängendem Graphen $G$ geraden Grad, so ist $G$ eulerisch.
Beweis durch Induktion über die Anzahl $m$ der Kanten.
\textbf{I.A.}:
\begin{itemize}
\item $m=0 \rightarrow$ trivial
\item $m = 1$: nicht möglich
\item $m = 2$: Da $G$ zusammenhängend ist, können in diesem Fall nur zwei
Ecken zweifach miteinander verbunden sein $\Rightarrow$ auch eulersch
\end{itemize}
\textbf{I.V.}: Sei $m \in \mathbb{N}_{\geq 2}$ die Anzahl der Kanten eines
Graphs $G$ und jeder zusammenhängende Graph mit weniger als $m$ Kanten und
ausschließlich Knoten geraden Grades sei eulerisch.
\textbf{I.S.}
Jeder Knoten hat mindestens Grad 2 (zusammenhängend + gerader Grad)
$\Rightarrow$ es gibt einen Kreis in $G$. TODO
Sei nun $C$ ein Kreis in $G$ mit maximaler Länge.
Annahme: $C$ ist kein Eulerkreis
Wir entfernen alle Kanten in $C$ aus $G$ und nennen das Ergebnis $G^*$.
Dann hat jeder Zusammenhängende Teilgraph in $G^*$ nur Knoten geraden Grades
und hat daher einen Eulerkreis. Dieser Eulerkreis hat keine Kante, die in $C$
enthalten ist und könnte deshalb zu $C$ hinzugefügt werden, wodurch $C$ Länger
werden würde $\Rightarrow$ Widerspruch $\Rightarrow C$ ist ein Eulerkreis
$\Rightarrow G$ ist eulersch $\blacksquare$
\end{document}

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

View file

@ -0,0 +1,36 @@
SOURCE = Vertex-coloring-brute-force
DELAY = 80
DENSITY = 300
WIDTH = 512
make:
pdflatex $(SOURCE).tex -output-format=pdf
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
make
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
rm $(SOURCE)2.svg

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View file

@ -0,0 +1,38 @@
\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage{amssymb,amsmath,amsfonts} % nice math rendering
\usepackage{braket} % needed for \Set
\usepackage{algorithm,algpseudocode}
\renewcommand{\thealgorithm}{3} %disable numbers for algorithm
\begin{document}
\begin{preview}
\begin{algorithm}[H]
\begin{algorithmic}
\Require $G = (V, E)$ an undirected graph
\State $n \gets |V|$
\State Give all vertices an index $1 \leq i \leq n$ that defines an order
\For{$i \in 1, \dots, n$}
\State $v_i$.color $\gets 0$
\EndFor
\\
\If{$n==1$}
\State \Return
\Else
\For{$maxColors \in 2, \dots, n$}
\While{$G$ is not properly colored and not all vertices have color $(maxColors-1)$}
\State $(v_1 v_2 \dots v_n) \gets (v_1 v_2 \dots v_n) + 1$ \Comment{count up in base $maxColor$}
\EndWhile
\EndFor
\EndIf
\end{algorithmic}
\caption{Find a vertex coloring for $G$ with brute force}
\label{alg:vertexColoring}
\end{algorithm}
\end{preview}
\end{document}

View file

@ -0,0 +1,36 @@
\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage{amssymb,amsmath,amsfonts} % nice math rendering
\usepackage{braket} % needed for \Set
\usepackage{algorithm,algpseudocode}
\begin{document}
\begin{preview}
\begin{algorithm}[H]
\begin{algorithmic}
\Require $G = (V, E)$ an undirected graph
\State $n \gets |V|$
\State Give all vertices an index $1 \leq i \leq n$ that defines an order
\For{$i \in 1, \dots, n$}
\State $v_i$.color $\gets 1$
\EndFor
\\
\For{$i \in 1, \dots, n$}
\For{$j \in i+1, \dots, n$}
\If{$\Set{v_i, v_j} \in E \land v_i.\text{color} = v_j.\text{color}$}
\State $v_j.color \gets v_j.color + 1$
\EndIf
\EndFor
\EndFor
\end{algorithmic}
\caption{Find a vertex coloring for $G$}
\label{alg:vertexColoring}
\end{algorithm}
\end{preview}
\end{document}

View file

@ -0,0 +1,39 @@
\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage{amssymb,amsmath,amsfonts} % nice math rendering
\usepackage{braket} % needed for \Set
\usepackage{algorithm,algpseudocode}
\renewcommand{\thealgorithm}{2} %disable numbers for algorithm
\begin{document}
\begin{preview}
\begin{algorithm}[H]
\begin{algorithmic}
\Require $G = (V, E)$ an undirected graph
\State $n \gets |V|$
\State Give all vertices an index $1 \leq i \leq n$ that defines an order
\For{$i \in 1, \dots, n$}
\State $v_i$.color $\gets 1$
\EndFor
\\
\For{$i \in 1, \dots, n$}
\State $possible \gets \Set{1, \dots, n}$
\For{$j \in i+1, \dots, n$}
\If{$\Set{v_i, v_j} \in E$}
\State $possible \gets possible \setminus \Set{v_j.\text{color}}$
\EndIf
\EndFor
\State $v_i$.color $\gets \min(possible)$
\EndFor
\end{algorithmic}
\caption{Find a vertex coloring for $G$}
\label{alg:vertexColoring}
\end{algorithm}
\end{preview}
\end{document}

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -1,16 +1,12 @@
\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{ifthen}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\tikzstyle{vertex}=[draw,red,fill=red,circle,
minimum size=10pt,inner sep=0pt]
\tikzstyle{edge}=[red, very thick]
\begin{document}
\begin{preview}
\begin{tikzpicture}
\newcommand{\n}{10}
\foreach \y in {0, ..., \n}{
@ -28,5 +24,4 @@ minimum size=10pt,inner sep=0pt]
}
}
\end{tikzpicture}
\end{preview}
\end{document}

35
tikz/graph-v6-e8/Makefile Normal file
View file

@ -0,0 +1,35 @@
SOURCE = graph-v6-e8
DELAY = 80
DENSITY = 300
WIDTH = 512
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
make
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
rm $(SOURCE)2.svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](graph-v6-e8.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -0,0 +1,21 @@
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{ifthen}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\tikzstyle{vertex}=[draw,black,fill=blue,circle,minimum size=10pt,inner sep=0pt]
\tikzstyle{edge}=[very thick]
\begin{tikzpicture}
\node (a)[vertex,fill=lime] at (1,0) {};
\node (b)[vertex,fill=red] at (0,1) {};
\node (c)[vertex,fill=lime] at (1,2) {};
\node (d)[vertex,fill=blue] at (2,2) {};
\node (e)[vertex,fill=red] at (3,1) {};
\node (f)[vertex,fill=blue] at (2,0) {};
\draw[edge] (a) -- (b) -- (c) -- (d) -- (e) -- (f) -- (a) -- cycle;
\draw[edge] (b) -- (f);
\draw[edge] (b) -- (d);
\end{tikzpicture}
\end{document}