From b894088b7255a802b05ea403b2bf36c609c0d652 Mon Sep 17 00:00:00 2001
From: Camil Staps
Date: Sun, 11 Oct 2015 23:19:34 +0200
Subject: Start assignment 6

---
 assignment6.tex | 240 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 240 insertions(+)
 create mode 100644 assignment6.tex

(limited to 'assignment6.tex')

diff --git a/assignment6.tex b/assignment6.tex
new file mode 100644
index 0000000..60cd0bb
--- /dev/null
+++ b/assignment6.tex
@@ -0,0 +1,240 @@
+\documentclass[10pt,a4paper]{article}
+
+\usepackage[margin=2cm]{geometry}
+\usepackage{multicol}
+
+\let\assignment6
+
+\usepackage{enumitem}
+\setenumerate[1]{label=\assignment.\arabic*.}
+\setenumerate[2]{label=\textit{\alph*})}
+
+% textcomp package is not available everywhere, and we only need the Copyright symbol
+% taken from http://tex.stackexchange.com/a/1677/23992
+\DeclareTextCommandDefault{\textregistered}{\textcircled{\check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}}
+
+\usepackage{fancyhdr}
+\renewcommand{\headrulewidth}{0pt}
+\renewcommand{\footrulewidth}{0pt}
+\fancyhead{}
+\fancyfoot[C]{Copyright {\textcopyright} 2015 Camil Staps}
+\pagestyle{fancy}
+
+\usepackage{amsmath}
+\usepackage{amsthm}
+\usepackage{amsfonts}
+\DeclareMathAlphabet{\pazocal}{OMS}{zplm}{m}{n}
+
+\usepackage{tikz}
+\usepackage{array}
+\usepackage{caption}
+\usepackage[hidelinks]{hyperref}
+\usepackage{url}
+
+\parindent0pt
+
+\title{Algoritmen en Datastructuren - assignment \assignment}
+\author{Camil Staps\\\small{s4498062}}
+
+\begin{document}
+
+\maketitle
+\thispagestyle{fancy}
+
+\begin{multicols}{2}
+
+\begin{enumerate}
+    \item We start with the following residual graph:
+        
+        \begin{minipage}{\linewidth}
+            \centering
+            \begin{tikzpicture}[node distance=2cm,->,>=stealth,every node/.style={font=\scriptsize}]
+                \node[draw,circle] (s) {s};
+                \node[draw,circle,above right of=s] (u) {u};
+                \node[draw,circle,below right of=u] (x) {x};
+                \node[draw,circle,below right of=s] (v) {v};
+                \node[draw,circle,above right of=x] (y) {y};
+                \node[draw,circle,below right of=x] (z) {z};
+                \node[draw,circle,below right of=y] (t) {t};
+                \draw (s) -- node[above left]   {15} ++ (u);
+                \draw (s) -- node[below left]   {5} ++ (v);
+                \draw (s) -- node[below right]  {12} ++ (x);
+                \draw (t) -- node[above right]  {15} ++ (y);
+                \draw (u) -- node[above left]   {10} ++ (v);
+                \draw (u) -- node[above right]  {8} ++ (x);
+                \draw (v) -- node[below]        {8} ++ (z);
+                \draw (x) -- node[above left]   {5} ++ (y);
+                \draw (x) -- node[below]        {5} ++ (t);
+                \draw (z) -- node[below right]  {10} ++ (t);
+            \end{tikzpicture}
+        \end{minipage}\\
+        
+        We take $(s,x,t)$. This gives the graphs:
+
+        \begin{minipage}{\linewidth}
+            \centering
+            \begin{tikzpicture}[node distance=2cm,->,>=stealth,every node/.style={font=\scriptsize}]
+                \node[draw,circle] (s) {s};
+                \node[draw,circle,above right of=s] (u) {u};
+                \node[draw,circle,below right of=u] (x) {x};
+                \node[draw,circle,below right of=s] (v) {v};
+                \node[draw,circle,above right of=x] (y) {y};
+                \node[draw,circle,below right of=x] (z) {z};
+                \node[draw,circle,below right of=y] (t) {t};
+                \draw (s) -- node[above left]   {0/15} ++ (u);
+                \draw (s) -- node[below left]   {0/5} ++ (v);
+                \draw (s) -- node[below right]  {5/12} ++ (x);
+                \draw (t) -- node[above right]  {0/15} ++ (y);
+                \draw (u) -- node[above left]   {0/10} ++ (v);
+                \draw (u) -- node[above right]  {0/8} ++ (x);
+                \draw (v) -- node[below]        {0/8} ++ (z);
+                \draw (x) -- node[above left]   {0/5} ++ (y);
+                \draw (x) -- node[below]        {5/5} ++ (t);
+                \draw (z) -- node[below right]  {0/10} ++ (t);
+            \end{tikzpicture}
+        \end{minipage}
+        \begin{minipage}{\linewidth}
+            \centering
+            \begin{tikzpicture}[node distance=2cm,->,>=stealth,every node/.style={font=\scriptsize}]
+                \node[draw,circle] (s) {s};
+                \node[draw,circle,above right of=s] (u) {u};
+                \node[draw,circle,below right of=u] (x) {x};
+                \node[draw,circle,below right of=s] (v) {v};
+                \node[draw,circle,above right of=x] (y) {y};
+                \node[draw,circle,below right of=x] (z) {z};
+                \node[draw,circle,below right of=y] (t) {t};
+                \draw (s) -- node[above left]   {15} ++ (u);
+                \draw (s) -- node[below left]   {5} ++ (v);
+                \draw (s) -- node[below right]  {7} ++ (x);
+                \draw (t) -- node[above right]  {15} ++ (y);
+                \draw (t) -- node[below]        {5} ++ (x);
+                \draw (u) -- node[above left]   {10} ++ (v);
+                \draw (u) -- node[above right]  {8} ++ (x);
+                \draw (v) -- node[below]        {8} ++ (z);
+                \draw (x) -- node[above left]   {5} ++ (y);
+                \draw (x) edge[bend left] node[below right] {5} (s);
+                \draw (z) -- node[below right]  {10} ++ (t);
+            \end{tikzpicture}
+        \end{minipage}\\
+
+        Then we take $(s,v,z,t)$, yielding:
+
+        \begin{minipage}{\linewidth}
+            \centering
+            \begin{tikzpicture}[node distance=2cm,->,>=stealth,every node/.style={font=\scriptsize}]
+                \node[draw,circle] (s) {s};
+                \node[draw,circle,above right of=s] (u) {u};
+                \node[draw,circle,below right of=u] (x) {x};
+                \node[draw,circle,below right of=s] (v) {v};
+                \node[draw,circle,above right of=x] (y) {y};
+                \node[draw,circle,below right of=x] (z) {z};
+                \node[draw,circle,below right of=y] (t) {t};
+                \draw (s) -- node[above left]   {0/15} ++ (u);
+                \draw (s) -- node[below left]   {5/5} ++ (v);
+                \draw (s) -- node[below right]  {5/12} ++ (x);
+                \draw (t) -- node[above right]  {0/15} ++ (y);
+                \draw (u) -- node[above left]   {0/10} ++ (v);
+                \draw (u) -- node[above right]  {0/8} ++ (x);
+                \draw (v) -- node[below]        {5/8} ++ (z);
+                \draw (x) -- node[above left]   {0/5} ++ (y);
+                \draw (x) -- node[below]        {5/5} ++ (t);
+                \draw (z) -- node[below right]  {5/10} ++ (t);
+            \end{tikzpicture}
+        \end{minipage}
+        \begin{minipage}{\linewidth}
+            \centering
+            \begin{tikzpicture}[node distance=2cm,->,>=stealth,every node/.style={font=\scriptsize}]
+                \node[draw,circle] (s) {s};
+                \node[draw,circle,above right of=s] (u) {u};
+                \node[draw,circle,below right of=u] (x) {x};
+                \node[draw,circle,below right of=s] (v) {v};
+                \node[draw,circle,above right of=x] (y) {y};
+                \node[draw,circle,below right of=x] (z) {z};
+                \node[draw,circle,below right of=y] (t) {t};
+                \draw (s) -- node[above left]   {15} ++ (u);
+                \draw (s) -- node[below right]  {7} ++ (x);
+                \draw (t) -- node[above right]  {15} ++ (y);
+                \draw (t) -- node[below]        {5} ++ (x);
+                \draw (t) edge[bend left] node[below right] {5} (z);
+                \draw (u) -- node[above left]   {10} ++ (v);
+                \draw (u) -- node[above right]  {8} ++ (x);
+                \draw (v) -- node[below left]   {5} ++ (s);
+                \draw (v) -- node[below]        {3} ++ (z);
+                \draw (x) -- node[above left]   {5} ++ (y);
+                \draw (x) edge[bend left] node[below right] {5} (s);
+                \draw (z) -- node[above left]  {5} ++ (t);
+                \draw (z) edge[bend left] node[below] {5} (v);
+            \end{tikzpicture}
+        \end{minipage}\\
+
+        We take $(s,u,v,z,t)$, which gives:
+
+        \begin{minipage}{\linewidth}
+            \centering
+            \begin{tikzpicture}[node distance=2cm,->,>=stealth,every node/.style={font=\scriptsize}]
+                \node[draw,circle] (s) {s};
+                \node[draw,circle,above right of=s] (u) {u};
+                \node[draw,circle,below right of=u] (x) {x};
+                \node[draw,circle,below right of=s] (v) {v};
+                \node[draw,circle,above right of=x] (y) {y};
+                \node[draw,circle,below right of=x] (z) {z};
+                \node[draw,circle,below right of=y] (t) {t};
+                \draw (s) -- node[above left]   {3/15} ++ (u);
+                \draw (s) -- node[below left]   {5/5} ++ (v);
+                \draw (s) -- node[below right]  {5/12} ++ (x);
+                \draw (t) -- node[above right]  {0/15} ++ (y);
+                \draw (u) -- node[above left]   {3/10} ++ (v);
+                \draw (u) -- node[above right]  {0/8} ++ (x);
+                \draw (v) -- node[below]        {8/8} ++ (z);
+                \draw (x) -- node[above left]   {0/5} ++ (y);
+                \draw (x) -- node[below]        {5/5} ++ (t);
+                \draw (z) -- node[below right]  {8/10} ++ (t);
+            \end{tikzpicture}
+        \end{minipage}
+        \begin{minipage}{\linewidth}
+            \centering
+            \begin{tikzpicture}[node distance=2cm,->,>=stealth,every node/.style={font=\scriptsize}]
+                \node[draw,circle] (s) {s};
+                \node[draw,circle,above right of=s] (u) {u};
+                \node[draw,circle,below right of=u] (x) {x};
+                \node[draw,circle,below right of=s] (v) {v};
+                \node[draw,circle,above right of=x] (y) {y};
+                \node[draw,circle,below right of=x] (z) {z};
+                \node[draw,circle,below right of=y] (t) {t};
+                \draw (s) -- node[above]   {12} ++ (u);
+                \draw (u) edge[bend right] node[above left] {3} (s);
+                \draw (s) -- node[below right]  {7} ++ (x);
+                \draw (t) -- node[above right]  {15} ++ (y);
+                \draw (t) -- node[below]        {5} ++ (x);
+                \draw (t) edge[bend left] node[below right] {8} (z);
+                \draw (u) -- node[above left]   {7} ++ (v);
+                \draw (v) edge[bend left] node[above left] {3} (u);
+                \draw (u) -- node[above right]  {8} ++ (x);
+                \draw (v) -- node[below left]   {5} ++ (s);
+                \draw (x) -- node[above left]   {5} ++ (y);
+                \draw (x) edge[bend left] node[below right] {5} (s);
+                \draw (z) -- node[above left]  {2} ++ (t);
+                \draw (z) -- node[below] {8} ++ (v);
+            \end{tikzpicture}
+        \end{minipage}\\
+
+        Now it is clear that there is no augmenting path $s\leadsto t$ exists any more. $t$ is only reachable from $z$, which is only reachable from $t$. The flow we find is $3+5+5=13$.
+
+    \item For every vertex $v\in V$ we create two vertices $v'_i,v'_o$, and we define $$V' = \{v'_i, v'_o \mid v\in V\}.$$ Then, define \begin{align*}E' =\;& \{(v'_o,w'_i,c) \mid (v,w,c)\in E\} \\&\cup \{(v'_i,v'_o,l(v) \mid v\in V\}.\end{align*}
+
+            Informally, we split up every original vertex in an input vertex and an output vertex. The input vertex has all the incoming edges, the output vertex all the outgoing edges. The input vertex corresponding to some $v\in V$ has one outgoing edge, which is the only incoming edge of the corresponding output vertex, and has capacity $l(v)$.
+
+            Intuitively we reduce the maximum flow problem in a graph with vertex capacities $(V,E)$ to the standard maximum flow problem in $(V',E')$, where we take $s'_i$ as start node and $t'_o$ as termination node.
+
+    \item %todo
+
+    \item %todo
+
+    \item %todo
+
+\end{enumerate}
+
+\end{multicols}
+
+\end{document}
+
-- 
cgit v1.2.3

