\begin{algorithm}
\begin{algorithmic}
\Function{Push}{$u$, $v$}
- \State $f_{aug} \gets \min(c_f(u, v), e(u))$
- \State $f(u, v) \mathrel{+}= f_{aug}$
- \State $e(u) \mathrel{-}= f_{aug}$
- \State $e(v) \mathrel{+}= f_{aug}$
+ \State $f_\text{aug} \gets \min(c_f(u, v), e(u))$
+ \State $f(u, v) \mathrel{+}= f_\text{aug}$
+ \State $e(u) \mathrel{-}= f_\text{aug}$
+ \State $e(v) \mathrel{+}= f_\text{aug}$
\EndFunction
\end{algorithmic}
\caption{\sf The push procedure of the Push-Relabel algorithm}
% \If{$u$ is only node at its height}
% \Call{Gap}{$u$}
% \Else
- \If{there is a $v$ such that $(u, v) \in E_f$}
+ \If{there is a $v \in V$ such that $(u, v) \in E_f$}
\State $d(u) \gets \min\{d(v), \; \forall v \in V : (u,v) \in E_f\} + 1$
\Else
\State $d(u) \gets N$
satisfied before the procedure was started.
\subsection{Putting it all together}
+
+\fixme{Should be clearer what is really happening, and especially when
+ we are finished/what our goal is. That we are finished as soon as
+ there are no more active vertices. And that how we get there does
+ not matter as long as we follow our constraints.
+}
+
In the first phase of the algorithm we initialize a valid preflow and
distance labeling by saturating all edges out of the source $s$, and
then setting its distance label $d(s) = N$. We then run the push and
\fixme{What is saturated?}
A vertex $u$ can only be successfully relabeled to obtain a new label if
-the edges outgoing edges of $u$ in the residual network have changed.
-This is why the push and relabel procedures often are combined into a
-\emph{discharge} procedure as shown in Algorithm \ref{alg:discharge}.
-When it is run on an active node $u$, as much as possible of the excess
-flow is pushed to other nodes before a relabeling is done.
+the outgoing edges of $u$ in the residual network have changed since the
+previous relabeling. This is why the push and relabel procedures often
+are combined into a \emph{discharge} procedure as shown in Algorithm
+\ref{alg:discharge}. When it is run on an active vertex $u$, we push as
+much as possible of the excess flow to other vertices before the vertex
+is relabeled.
\begin{algorithm}
\begin{algorithmic}
\Function{Discharge}{$u$}
- \ForAll{$v$ neighbor of $u$}
- \If{$c_f(u, v) > 0$ and $h(u) = h(v) + 1$}
+ \ForAll{$v \in V$ such that $(u, v) \in E_f$}
+ \If{$c_f(u, v) > 0$ and $d(u) = d(v) + 1$}
\Call{Push}{$u$, $v$}
\EndIf
\EndFor
\end{algorithm}
In the second phase of the algorithm this preflow is turned into a
-maximum flow by sending excess flow from inside the network back to the
-source. We can skip this part of the algorithm, as we are only
-interested in finding a minimum cut, and not the maximum flow.
-
-The following theorem allows us to find a minimum cut after the first
-phase of the algorithm is finished.
+maximum flow by sending excess flow which did not reach the sink, from
+inside the network back to the source. We can skip this part of the
+algorithm, as it is possible to identify a minimum cut as soon as the
+first phase is finished, and the following theorem allows us to do that.
\begin{theorem}[Cut identification]
Given a network $G = (V, E, c)$, assume that the first phase of
the push-relabel algorithm has terminated and no more active nodes
- remain. Then there exists an $k \in \mathbb{N} \cap \left(0,
- N \right)$ such that there is no vertex with label $k$, and the
- vertex sets $S = \{ u : d(u) > k\}$ and $T = V - S$ define a minimum
+ remain. Then there exists a $k \in \mathbb{N} \cap \left(0, N
+ \right)$ such that there is no vertex with label $k$, and the vertex
+ sets $S = \{ u \in V : d(u) > k\}$ and $T = V - S$ define a minimum
cut $C = (S, T)$ in $G$.
\label{thm:cut_identification}
\end{theorem}
\begin{proof}
There are $N$ nodes, the source has label $N$ and the sink has label
- $0$, so the $N - 2$ remaining vertices can not occupy all the $N-1$
- other labels, and there must exist an $k$ as described.
+ $0$, and the $N - 2$ remaining vertices can not occupy all the $N-1$
+ labels in $\{1, \ldots, N-1\}$, so there must exist an $k$ as
+ described.
- As no vertex has label $k$, the set $T$ contains all (and only)
- vertices with labels less than $k$.
+ As no vertex has label $k$, we can write $T = \{ u \in V : d(u) >
+ k\}$.
- Assume there was an edge non-saturated edge $(u, v) \in E_f$ such
- that $u \in S$ and $v \in T$. From the construction of $S$ and $T$,
- we have $d(v) \leq d(u) + 2$, which contradicts the labeling
- constraint, so no such non-saturated edge from $S$ to $T$ can
- exist. From the construction of $E_f$ we now know that all edges
- from $S$ to $T$ are saturated, and all edges from $T$ to $S$ have
- no flow. This means that the capacity of the cut is equal to the
- flow through the cut, i.e.\ $c(S, T) = f(S, T)$.
+ Assume there was an edge $(u, v) \in E_f$ such that $u \in S$ and $v
+ \in T$. From the construction of $S$ and $T$, we would have $d(v)
+ \leq d(u) + 2$, which contradicts the labeling constraint, so no
+ such non-saturated edge from $S$ to $T$ can exist.
+
+ From the construction of $E_f$ we now know that all edges in $E$
+ from $S$ to $T$ are saturated, and all edges from $T$ to $S$ have no
+ flow. This means that the capacity of the cut is equal to the flow
+ through the cut, i.e.\ $c(S, T) = f(S, T)$.
Since the first phase of the algorithm has terminated, there can be
no active vertices, and therefore no excess in $T$, except for the
We will see later that with the gap relabeling heuristic, there will
always be a gap at label $k = N - 1$ such that we can construct our cut
-by taking $S = \{ u : d(u) \geq N \}$.
+by taking $S = \{ u \in V : d(u) \geq N \}$.
\fixme{Sketch of proof, could be nicer, shorter (split up?) and more
rigorous maybe.}
\subsection{Complexity}
Bleep bloop.
\fixme{Edge list problematikk.}
+\fixme{We have proved that when the first phase has terminated, we can
+ find the minimum cut, but should we maybe prove that the first phase
+ will terminate? Using the fact that the distance labels can only
+ increase? And the fact that we only push to lower vertices?
+ Computing the complexity is kind of like proving termination since
+ we find an upper bound on the number of operations.
+}
\subsection{Vertex selection rules}
\fixme{Also mention this over complexity.}
\subsection{Heuristics}
Different heuristics exists that can speed up the algorithm
considerably. Being heuristics, they are not guaranteed to work, and
-might perform differently on different kinds of graphs. The most used
-heuristics are the gap- and global relabeling heuristics, both aiming to
-reduce the total number of relabelings needed.
+might perform differently on different kinds of networks. The most used
+heuristics are the gap and global relabeling heuristics, both aiming to
+reduce the total number of relabeling steps.
The gap relabeling heuristic aims to find a label $k$ as in Theorem
\ref{thm:cut_identification} such that no vertex has that label.
-Realizing that no more flow can ever be sent from the nodes $u$ such
-that $d(u) > k$ we can relabel them with label $N$ and never consider
-them again as they will never become active. Algorithm \ref{alg:gap}
-shows a pseudocode representation of what is done once a gap $k$ is
-found.
+From vertices $u$ with $d(u) > k$, there are no unsaturated edges going
+to vertices with smaller distance labels so no more flow can ever find
+its way from these vertices to the sink. These vertices are therefore
+given the label $N$ and never considered again as they will never become
+active. Algorithm \ref{alg:gap} shows a pseudocode representation of
+what is done once a gap $k$ is found.
\begin{algorithm}
\begin{algorithmic}
\Function{Gap}{$k$}
- \ForAll{$u$ such that $d(u) \geq k$}
+ \ForAll{$u \in V$ such that $d(u) > k$}
\State $d(u) \gets N$
\EndFor
\EndFunction
\begin{lemma}[Gap relabeling validity]
Given a network $G = (V, E, c)$, a distance labeling $d$ and a
preflow $f$, assume there exists a gap $k$ such that no vertex has
- label $k$. Then running the gap relabeling procedure on label $k$
- will yield a valid distance labeling and an unchanged and valid
- preflow $f$.
+ label $k$. Running the gap relabeling procedure on label $k$ will
+ yield a valid distance labeling and an unchanged and valid preflow
+ $f$.
\end{lemma}
\begin{proof}
- No new edges are created, no edges disappear, the flow is conserved
- and only the labels are changed, so the preflow and capacity
- constraint remain fulfilled after the gap relabeling.
+ No new edges are created, no edges disappear, the preflow is
+ unchanged, so the preflow and capacity constraint remain satisfied
+ after the gap relabeling.
Define the vertex sets $S = \{ u \in V : d(u) > k\}$ and $T = V -
S$. Initially, we have $d(u) \leq d(v) + 1$ for every edge $(u,v)
\end{description}
Hence, both the preflow $f$ and distance labeling $d$ are valid.
+
+ \fixme{A bit long, could be more compact since it is not really a
+ very interesting proof? (And it's not really a lemma either?)}
\end{proof}
When running the push-relabel algorithm with the gap heuristic, we can
be sure that there will never be a node $u$ with label $d(u) = N-1$ at
the end of the algorithm, i.e.\ we know that there will always be a gap
-at label $N-1$. Using the same reasoning as in Theorem \fixme{ref}, if
-there was a vertex with label $N-1$, there would only be $N-3$ possibly
-having labels in $[1, N-2]$, so a gap must exist somewhere in that
-interval. When using the gap relabeling heuristic, such a gap can no
-exist, so we can conclude that there is no vertex with label $N-1$.
+at label $N-1$. Using the same reasoning as in Theorem
+\ref{thm:cut_identification}, if there was a vertex with label $N-1$,
+there would only be $N-3$ possibly having labels in $[1, N-2]$, so a gap
+must exist somewhere in that interval. When using the gap relabeling
+heuristic, such a gap can not exist, so we can conclude that there is no
+vertex with label $N-1$.
-Using Theorem \fixme{ref} we can then conclude that the sets $S = \{ u
-\in V : d(u) \geq N\}$ and $T = V - S$ form a minimum cut of the network.
+Using Theorem \ref{thm:cut_identification} we can then conclude that the
+sets $S = \{ u \in V : d(u) \geq N\}$ and $T = V - S$ form a minimum cut
+of the network.
\fixme{Ugh, what a mess. Lemma maybe?}
\subsection{Parametric push-relabel algorithm}
Now we have an algorithm for finding a minimum $s$-$t$-cut in a network,
-so let's return to the network constructed in Section \fixme{ref}. For
-every level $\lambda \in ??$ we want to find a minimum $s$-$t$-cut which
-gives us the thresholded image $u^\lambda$. These can then hopefully be
-stacked together to form the final image $u$.
+so let's return to the network constructed in Section
+\ref{sec:network_construction}. For every level $\lambda \in \{0,
+\ldots, L\}$ we want to find a minimum $s$-$t$-cut which gives us the
+thresholded image $u^\lambda$. These can then hopefully be stacked
+together to form the final image $u$.
\subsubsection{Network reuse}
-Solving \fixme{??} separate minimum cut problems seems like a lot of
-work, but when using the push-relabel algorithm we will, if we do things
-in the right order, be able to reuse the network when going from one
-label to the next.
+Solving $L$ separate minimum cut problems seems like a lot of work, but
+when using the push-relabel algorithm we will, if we do things in the
+right order, be able to reuse the network when going from one label to
+the next.
\begin{figure}
\input{fig/norm_evolution}
only the capacity of edges from sub-networks representing the fidelity
term depend on our level parameter $\lambda$. From the expression in
\eqref{eq:fidelity_energy0}, visualized in Figure
-\ref{fig:norm_evolution} we see that the energy term $E^x(0)$ increases
+\ref{fig:norm_evolution}, we see that the energy term $E^x(0)$ increases
monotonically with increasing $\lambda$ parameter. Let $u, v \in V -
\{s, t\}$. Since the edges in Figure \ref{fig:norm_subgraph} now are the
only ones depending on $\lambda$, the following is true for
\emph{decreasing} values of $\lambda$
\begin{description}
\item[Edges from $s$ to $u$]
- As seen in Figure \fixme{ref} the capacity of these edges will
- increase monotonically with decreasing $\lambda$ parameter.
+ As seen in Figure \ref{fig:norm_subgraph_neg} the capacity of
+ these edges will increase monotonically with decreasing
+ $\lambda$ parameter.
\item[Edges from $u$ to $v$]
These edges have no $\lambda$-dependence and will remain
unchanged.
\item[Edges from $v$ to $t$]
- As seen in Figure \fixme{ref} the capacity of these edges will
- decrease monotonically with decreasing $\lambda$ parameter.
+ As seen in Figure \ref{fig:norm_subgraph_pos} the capacity of
+ these edges will decrease monotonically with decreasing
+ $\lambda$ parameter.
\end{description}
After running the push-relabel algorithm for $\lambda = k$, we are left
with a network $G = (V, E, c)$, a preflow $f$ and a labeling $d$. To
obtain the network for $\lambda = k-1$ we have to change the capacity of
-two different kinds of edges, and this is done in the following way
+two different kinds of edges, and this is done in the following way to
+keep the capacity and preflow constraints satisfied.
\begin{description}
\item[Edges from $s$ to $u$]
The capacity $c(s, u)$ is increased, and the flow is set to be
which will decrease the excess of the sink $t$, and increase the
excess of $v$.
\end{description}
-The preflow and capacity constraints are trivially satisfied.
None of these actions will create new edges in the residual network, and
we do not change the labeling $d$, so the labeling constraints are also
the flow and labels.
\subsubsection{Output image construction}
-\fixme{Mention earlier that with gap relabeling, we gap at N.}
We mentioned already in section \ref{sec:total_energy} that in order to
be able to construct our output image $u$, the thresholded images
-$u^\lambda$ would have to stack one on top of the other \fixme{as shown
-in Figure ??}. We will now show that through reuse of the distance
-labels from the last iteration of the push-relabel algorithm, we can
-guarantee that it is possible to stack the thresholded images.
+$u^\lambda$ would have to stack one on top of the other as shown in
+Figure \ref{fig:img_decomp}. We will now show that through reuse of the
+distance labels from the last iteration of the push-relabel algorithm,
+we can guarantee that it is possible to stack the thresholded images.
+
+\fixme{More precise statement than ``stack on top of each other''}
Consider two subsequent runs of the push-relabel algorithm, for labels
-$\lambda = k$ and $\lambda = k-1$ ending with distance labelings $d^k$
-and $d^{k-1}$ respectively. We already know that the distance
-labels $d$ are monotonically increasing. This means that the set $\{ u
-\in V : d(u) \geq N \}$ is increasing in size, more precisely, we have
-the inclusion
+$\lambda = k$ and $\lambda = k-1$ ending with distance labels $d^k$ and
+$d^{k-1}$ respectively. We already know that the distance labels $d$ are
+monotonically increasing. This means that the set $\{ u \in V : d(u)
+\geq N \}$ is increasing in size, more precisely, we have the inclusion
\begin{equation}
\{ u \in V : d^k(u) \geq N \} \subseteq \{ u \in V : d^{k-1}(u) \geq
N \}
We then construct our output image $u$ by giving each pixel the value
\begin{equation}
- u_x = \min \{ \lambda \in [0, L-1] : u^\lambda_x = 1 \}.
+ u_x = \min \{ \lambda \in \{0, \ldots, L-1\} : u^\lambda_x = 1 \}.
\end{equation}
This marks the end of the description of the implemented algorithm, but
we will further discuss some possible improvements, and also look at