\subsubsection{Auxiliary Multicut}
Given a graph $G$ and a function $f : V(G) \to [p]$, the \emph{cost} of $f$ in $G$, denoted $\mathfrak{c}_G(f)$ is defined as the number of edges $e = uv \in E(G)$ with $f(u) \neq f(v)$.
We use the following intermediate problem, which we call \textsc{Auxiliary Multicut}.
The input consists of a graph $G$, integers $k,p$, terminal sets $(T_i)_{i=1}^\tau$ (not necessarily disjoint), and a set $I \subseteq [\tau] \times [p]$.
The goal is to find a function $f \colon V(G) \to [p]$ of cost at most $k$ such that for every $(i,j) \in I$, there exists $v \in T_i$ with $f(v) = j$.

\begin{theorem}\label{thm:auxcut}
\textsc{Auxiliary Multicut} on connected graphs $G$ can be solved in time $2^{\mathcal{O}((k+|I|) \log (k+|I|))} n^{\mathcal{O}(1)}$.
\end{theorem}
\begin{proof}
Let $(G,k,p,(T_i)_{i=1}^\tau,I^\circ)$ be an input to \textsc{Auxiliary Multicut}. Assume $G$ is connected and let $n = |V(G)|$.
Without loss of generality, we can assume that every set $T_i$ is nonempty and for every $j \in [p]$ there exists some $i \in [\tau]$ with $(i,j) \in I^\circ$.
Thus, the image of the sought function $f$ (henceforth called a \emph{solution}) needs to be equal the whole $[p]$.
Consequently, the connectivity of $G$ allows us to assume $p \leq k+1$, as otherwise the input instance is a no-instance: any such function $f$ would have cost larger than $k$.

We invoke the algorithm of Theorem~\ref{thm:decomp} to $G$ and $k$,
obtaining a rooted compact
tree decomposition $(T,\beta)$ of $G$ whose every bag is $(k,k)$-edge-unbreakable
and every adhesion is of size at most $k$. The running time of this step
is $2^{\mathcal{O}(k \log k)} n^{\mathcal{O}(1)}$.

We perform a bottom-up dynamic programming algorithm on $(T,\beta)$.
For every node $t \in V(T)$, every subset $I \subseteq I^\circ$, and every
function $f^\sigma\colon \sigma(t) \to [p]$ we compute a value $M[t, I, f^\sigma] \in \{0, 1, 2, \ldots, k, +\infty\}$
with the following properties.

\begin{enumerate}[label={(\alph*)}]
\item If $M[t,I, f^\sigma] \neq +\infty$, then there exists a function $f : V(G_t) \to [p]$ such that:\label{i:ac:cmpl}
\begin{itemize}
\item $f|_{\sigma(t)} = f^\sigma$,
\item for every $(i,j) \in I$ there exists $w\in V(G_t) \cap T_i$ with $f(w) = j$,
\item the cost of $f$ in $G_t$ is at most $M[t,I,f^\sigma]$.
\end{itemize}
\item For every function $f \colon V(G) \to [p]$ that satisfies:\label{i:ac:sound}
\begin{itemize}
\item $f|_{\sigma(t)} = f^\sigma$,
\item for every $(i,j) \in I^\circ$ there exists $w \in T_i$ with $f(w) = j$, and,
  furthermore, if $i \in I$, then there exists such $w$ in $T_i \cap V(G_t)$,
\item the cost of $f$ in $G$ is at most $k$,
\end{itemize}
the cost of $f|_{V(G_t)}$ in $G_t$ is at least $M[t,I,f^\sigma]$.
\end{enumerate}

We first observe that the table $M[\cdot]$ is sufficient for our purposes.
\begin{claim}\label{cl:ac:M}
There exists a solution if and only if
$M[r,I^\circ,\emptyset] \neq +\infty$ for the root $r$ of $T$.
\end{claim}
\begin{proof}
In one direction, if $f$ is a solution, then note that
$f$ satisfies all conditions of Point~\ref{i:ac:sound} for the cell
$M[r,I^\circ,\emptyset]$. Hence, by Point~\ref{i:ac:sound}, $M[r,I^\circ,\emptyset] < +\infty$.

In the other direction, let $M[r,I^\circ,\emptyset] < +\infty$ and
let $f$ be the function whose existence is asserted by Point~\ref{i:ac:cmpl}.
Then for every $(i,j) \in I^\circ$ there exists $w \in T_i$ with $f(w) = j$ and its cost in $G_r = G$ is at most $k$.
Consequently, $f$ is a solution.
\renewcommand{\qed}{\cqedsymbol}\end{proof}

Thus, to prove Theorem~\ref{thm:auxcut}, it suffices to show how to compute in time
$2^{\mathcal{O}((|I^\circ| + k) \log (k + |I^\circ|))} n^{\mathcal{O}(1)}$ entries $M[t,\cdot,\cdot]$ for a fixed node $t \in V(T)$, given
entries $M[s,\cdot,\cdot]$ for all children $s$ of $t$ in $T$. Since $|\sigma(t)| \leq k$ and $p \leq k+1$,
it suffices to focus on a computation of a single cell $M[t,I,f^\sigma]$.
Let $Z$ be the set of children of $t$ in~$T$.

In a single step of a dynamic programming algorithm, we would like to focus on finding
a function $f^\beta : \beta(t) \to [p]$ that extends $f^\sigma$
and read the best way to extend $f^\beta$ to subgraphs $G[\alpha(s)]$
for $s \in Z$ from the tables $M[s,\cdot,\cdot]$.
To this end, every adhesion $\sigma(s)$ for $s \in Z$ serves as a ``black-box'' that, given
$f_s^\sigma : \sigma(s) \to [p]$ and a request $I_s \subseteq I$, returns the minimum possible cost in $G_s$
of an extension $f_s$ of $f_s^\sigma$ that satisfies the request $I_s$ (i.e., for every $(i,j) \in I_s$ there exists $w \in T_i \cap V(G_s)$ with $f_s(w) = j$).
Within the same framework, one can think of edges $e \in E(G_t[\beta(t)])$ as ``mini-black-boxes''
that force us to pay $1$ if $f^\beta$ assigns different values to the endpoints of $e$
and vertices $w \in T_i$ as ``mini-black-boxes'' that allow us to ``score'' a pair $(i,j) \in I$
if we assign $f^\beta(w) = j$.

This motivates the following definition of a family $\mathcal{C}$ of \emph{constraints};
every child $s \in Z$, every edge $e \in E(G_t[\beta(t)])$, and every pair $((i,j),w)$ for $(i,j) \in I$, $w \in T_i \cap \beta(t)$ gives raise to a single constraint.
A constraint $\Gamma \in \mathcal{C}$ consists of:
\begin{itemize}
\item a set $X_\Gamma \subseteq \beta(t)$ of size at most $k$;
\item a function $M_\Gamma: 2^{I} \times [p]^{X_\Gamma} \to \{0,1,2,\ldots,k,+\infty\}$.
\end{itemize}
For a child $s \in Z$, we define a \emph{child constraint} $\Gamma(s)$ as:
\begin{itemize}
\item $X_{\Gamma(s)} = \sigma(s)$,
\item $M_{\Gamma(s)}(I_s,f^\sigma_s) = M[s,I_s,f^\sigma_s]$ for every $I_s \subseteq I$ and $f^\sigma_s : \sigma(s) \to [p]$.
\end{itemize}
For an edge $uv = e \in E(G_t[\beta(t)])$, we define an \emph{edge constraint} $\Gamma(e)$ as:
\begin{itemize}
\item $X_{\Gamma(e)} = e$,
\item $M_{\Gamma(e)}(\emptyset, f^\sigma_e) = 0$
if $f^\sigma_e(u) = f^\sigma_e(v)$,
 $M_{\Gamma(e)}(\emptyset, f^\sigma_e) = 1$
if $f^\sigma_e(u) \neq f^\sigma_e(v)$,
and $M_{\Gamma(e)}(I_e, f^\sigma_e) = +\infty$ for every $I_e \neq \emptyset$ and $f^\sigma_e : e \to [p]$.
\end{itemize}
For a pair $((i,j),w)$ with $(i,j) \in I$ and $w \in \beta(t) \cap T_i$ we define a \emph{terminal constraint} $\Gamma(i,j,w)$ as:
\begin{itemize}
\item $X_{\Gamma(i,j,w)} = \{w\}$,
\item $M_{\Gamma(i,j,w)}(\emptyset, \cdot) = 0$, $M_{\Gamma(i,j,w)}(\{(i,j)\},f^\sigma_{i,j,w}) = 0$ if
$f^\sigma_{i,j,w}(w) = j$, and $M_{\Gamma(i,j,w)}(I_{i,j,w}, f^\sigma_{i,j,w}) = +\infty$ for every other $I_{i,j,w} \subseteq I$ and $f^\sigma_{i,j,w} : \{w\} \to [p]$.
\end{itemize}

A \emph{responsibility assignment} is a function $\rho$ that assigns to every constraint $\Gamma \in \mathcal{C}$ a subset $\rho(\Gamma) \subseteq I$ such that
the values $\rho(\Gamma)$ are pairwise disjoint.
For a function $f^\beta : \beta(t) \to [p]$ we define the \emph{majority value} $\mathfrak{j}(f^\beta)$ as the minimum $j \in [p]$ among values $j$
maximizing $|(f^\beta)^{-1}(j)|$ (that is, we take the smallest among the most common values of $f^\beta$).
A function $f^\beta : \beta(t) \to [p]$ is \emph{unbreakable-consistent} if either $|\beta(t)| \leq 3k$ or at most $k$ vertices of $\beta(t)$ are assigned values different
than $\mathfrak{j}(f^\beta)$.
A \emph{feasible function} is an unbreakable-consistent function $f^\beta : \beta(t) \to [p]$ that extends $f^\sigma$ on $\sigma(t)$.

Given a responsibility assignment $\rho$ and a feasible function $f^\beta$, their \emph{cost} is defined as
\begin{equation}\label{eq:ac:cost}
\mathfrak{c}(\rho,f^\beta) = \sum_{\Gamma \in \mathcal{C}} M_\Gamma(\rho(\Gamma), f^\beta|_{X_\Gamma}).
\end{equation}
We claim the following.
\begin{claim}\label{cl:ac:feas}
Assume that the values $M[s,\cdot,\cdot]$ satisfy Points~\ref{i:ac:cmpl} and~\ref{i:ac:sound} for every $s \in Z$.
Then the following assignment satisfies Points~\ref{i:ac:cmpl} and~\ref{i:ac:sound} for $t$:
\begin{equation}\label{cl:ac:Mdef}
M[t,I,f^\sigma] = \min \{ \mathfrak{c}(\rho, f^\beta)~|~\rho\mathrm{\ is\ a\ responsibility\ assignment,\ }f^\beta\mathrm{\ is\ a\ feasible\ function,\ }\bigcup_{\Gamma \in \mathcal{C}} \rho(\Gamma) = I \}.
\end{equation}
In the above, $M[t, I, f^\sigma] := +\infty$ if the right hand side exceeds $k$.
\end{claim}
\begin{proof}
Let $\rho^\ast$ and $f^{\beta,\ast}$ be values for which the minimum of the right hand side of~\eqref{cl:ac:Mdef} is attained.

Consider first Point~\ref{i:ac:cmpl} and assume $\rho^\ast$ and $f^{\beta,\ast}$ exist and $\mathfrak{c}(\rho^\ast, f^{\beta,\ast}) \leq k$.
In particular, from~\eqref{eq:ac:cost} we infer that for every $\Gamma \in \mathcal{C}$ we have $M_\Gamma(\rho^\ast(\Gamma), f^{\beta,\ast}|_{X_\Gamma}) \leq k$.
For every $s \in Z$ let $f_s$ be the function extending $f^{\beta,\ast}|_{\sigma(s)}$ whose existence is promised by Point~\ref{i:ac:cmpl} for the cell
$M[s, \rho^\ast(\Gamma(s)), f^{\beta,\ast}|_{\sigma(s)}] \leq k$.
We claim that
$$f := f^{\beta,\ast} \cup \bigcup_{s \in Z} f_s$$
satisfies the requirements for Point~\ref{i:ac:cmpl} for the cell $M[t, I, f^\sigma]$.

First, note that $f$ is well-defined as every $f_s$ agrees with $f^{\beta,\ast}$ on $\sigma(s)$.
Clearly, $f$ extends $f^\sigma$ as $f^{\beta,\ast}$ extends $f^\sigma$.

Second, fix $(i,j) \in I$; our goal is to show a vertex $w \in V(G_t) \cap T_i$ for which $f(w) = j$.
By~\eqref{cl:ac:Mdef}, we have $\bigcup_{\Gamma \in \mathcal{C}} \rho^\ast(\Gamma) = I$.
Hence, there exists $\Gamma \in \mathcal{C}$ with $(i,j) \in \rho(\Gamma)$.
Since $M_{\Gamma}(\rho^\ast(\Gamma), f^{\beta,\ast}|_{X_{\Gamma}}) \leq k$, $\Gamma$ is not an edge constraint $\Gamma(e)$.
If $\Gamma$ is a terminal constraint, $\Gamma = \Gamma((i,j),w)$, then from the definition of a terminal constraint we obtain that $f(w) = j$ and $w \in T_i$.
Finally, if $\Gamma$ is a child constraint, $\Gamma = \Gamma(s)$ for some $s \in Z$, then since $f_s$ is a function promised by Point~\ref{i:ac:cmpl} for the cell
$M[s, \rho^\ast(\Gamma(s)), f^{\beta,\ast}|_{\sigma(s)}]$ there exists $w \in V(G_s) \cap T_i$ with $f_s(w) = j$.
This concludes the proof that for every $(i,j) \in I$ there exists $w \in V(G_t) \cap T_i$ with $f(w) = j$.

Finally, let us compute the cost of $f$. Let $e = uv \in E(G_t)$ with $f(u) \neq f(v)$.
By the definition of the graphs $G_t$ and $G_s$, $s \in Z$, $e$ either belongs to $E(G_t[\beta(t)])$ or to exactly one of the subgraphs $G_s$, $s \in Z$.
In the first case, the constraint $\Gamma(e)$ contributes $1$ to $\mathfrak{c}(\rho^\ast, f^{\beta,\ast})$.
In the second case, for every $s \in Z$, the number of edges $e = uv \in E(G_s)$ with $f(u) \neq f(v)$ equals exactly the cost of $f_s$, which
is not larger than $M_{\Gamma(s)}(\rho^\ast(\Gamma(s)), f^{\beta,\ast}_{\sigma(s)})$.
Point~\ref{i:ac:cmpl} for the cell $M[t, I, f^\sigma]$ follows.

Let $f$ be a function as in Point~\ref{i:ac:sound} for the cell $M[t, I, f^\sigma]$.
Define responsibility assignment $\rho$ as follows. Start with $\rho(\Gamma) = \emptyset$ for every $\Gamma \in \mathcal{C}$.
For every $(i,j) \in I$, proceed as follows. By the properties of Point~\ref{i:ac:sound}, there exists $w \in V(G_t) \cap T_i$ with $f(w) = j$.
If $w \in \beta(t)$, then we insert $(i,j)$ into $\rho(\Gamma(i, j, w))$. Otherwise, $w \in V(G_s) \setminus \sigma(s)$ for some $s \in Z$; we insert then
$(i,j)$ into $\rho(\Gamma(s))$. Clearly, $\rho$ is a responsibility assignment and $\bigcup_{\Gamma \in \mathcal{C}} \rho(\Gamma) = I$.

We define $f^\beta = f|_{\beta(t)}$ and we claim that $f^\beta$ is a feasible function. Clearly, $f^\beta$ extends $f^\sigma$.
To show that $f^\beta$ is unbreakable-consistent, observe that the fact that $\beta(t)$ is $(k,k)$-edge-unbreakable in $G$ with conjunction with the assumption
that the cost of $f$ is at most $k$ implies that for every partition $[p] = J_1 \uplus J_2$ either $(f^\beta)^{-1}(J_1)$ or $(f^\beta)^{-1}(J_2)$ is of size at most $k$.
If $|(f^\beta)^{-1}(\mathfrak{j}(f^\beta))| > k$, then this implies that $|(f^\beta)^{-1}([p] \setminus \{\mathfrak{j}(f^\beta)\})| \leq k$, as desired.
Otherwise, we have $|(f^\beta)^{-1}(i)| \leq k$ for every $i \in [p]$, and unless $|\beta(t)| \leq 3k$ there exist a partition $[p] = J_1 \uplus J_2$ such that
$|(f^\beta)^{-1}(J_j)| > k$ for $j=1,2$, a contradiction. This proves that $f^\beta$ is unbreakable-consistent, and thus a feasible function.

To finish the proof of the claim, it suffices to show that for the above defined $\rho$ and $f^\beta$ the cost $\mathfrak{c}(\rho, f^\beta)$ is at most the cost of $f|_{V(G_t)}$ in $G_t$.
Note that the cost of $f|_{V(G_t)}$ in $G_t$ equals the cost of $f|_{\beta(t)}$ in $G_t[\beta(t)]$ plus the sum over all $s \in Z$ of the cost of $f|_{V(G_s)}$ in $G_s$.
Consider the types of constraints one by one.

First, consider a child constraint $\Gamma(s)$ for some $s \in Z$. By the definition of $\rho(\Gamma(s))$, $f$ satisfies the requirements for Point~\ref{i:ac:sound}
for the cell $M[s, \rho(\Gamma(s)), f|_{\sigma(s)}]$. Consequently, the cost of $f|_{V(G_s)}$ in $G_s$ is not smaller than
$M[s, \rho(\Gamma(s)), f|_{\sigma(s)}] = M_{\Gamma(s)}(\rho(\Gamma(s)), f|_{\sigma(s)})$.
The latter term is exactly the contribution of the constraint $\Gamma(s)$ to the cost $\mathfrak{c}(\rho,f^\beta)$.

Second, consider an edge $e = uv \in E(G_t[\beta(t)])$. Note that $\rho(\Gamma(e)) = \emptyset$ by definition while $M_{\Gamma(e)}[ \emptyset, f|_e]$ equals $1$
if $f(u) \neq f(v)$ and $0$ otherwise. Thus, the contribution of the edge $e$ towards the cost of $f|_{\beta(t)}$ in $G_t[\beta(t)]$ is the same as the contribution
of $\Gamma(e)$ towards $\mathfrak{c}(\rho,f^\beta)$.

Third, consider a terminal constraint $\Gamma(i,j, w)$. If $\rho(\Gamma(i,j, w)) = \emptyset$, then the contribution of this constraint to $\mathfrak{c}(\rho,f^\beta)$ is $0$.
Otherwise, we have $\rho(\Gamma(i,j, w)) = \{(i,j)\}$ and this can only happen if $f(w) = j$ and $w \in T_i$.
By definition, this implies $M_{\Gamma(i,j,w)}(\{(i,j)\}, f|_{\{w\}}) = 0$, and again the contribution of this constraint to $\mathfrak{c}(\rho,f^\beta)$ is $0$.

This concludes the proof that the cost of $f|_{V(G_t)}$ in $G_t$ is not smaller than $\mathfrak{c}(\rho, f^\beta)$ and concludes the proof of the claim.
\renewcommand{\qed}{\cqedsymbol}\end{proof}

By Claim~\ref{cl:ac:feas}, it suffices to minimize $\mathfrak{c}(\rho, f^\beta)$ over responsibility assignments $\rho$ and feasible functions $f^\beta$ such that $\bigcup_{\Gamma \in \mathcal{C}} \rho(\Gamma) = I$.
Assume that this minimum is at most $k$ and fix some minimizing arguments $(\rho^\ast, f^{\beta,\ast})$.
We say that a constraint $\Gamma$ is \emph{touched} if either $\rho^\ast(\Gamma) \neq \emptyset$ or $f^{\beta,\ast}|_{X_\Gamma}$ is not a constant function. We claim the following
\begin{claim}\label{cl:ac:touched}
There are at most $|I|+k$ touched constraints.
\end{claim}
\begin{proof}
By the assumption that the values $\rho^\ast(\Gamma)$ are pairwise disjoint, there are at most $|I|$ constraints
with $\rho^\ast(\Gamma) \neq \emptyset$.
Fix a constraint $\Gamma$ such that $f^{\beta,\ast}|_{X_\Gamma}$ is not a constant function. To finish the proof of the claim
it suffices to show that $\Gamma$ contributes at least $1$ to the sum in~\eqref{eq:ac:cost}.

Clearly, $\Gamma$ is not a terminal constraint. If $\Gamma$ is an edge constraint, $\Gamma = \Gamma(e)$
for some $e = uv \in E(G_t[\beta(t)])$, then as $X_{\Gamma(e)} = e$ we have $f^{\beta,\ast}(u) \neq f^{\beta,\ast}(v)$.
Hence, $\Gamma$ contributes $1$ to the sum in~\eqref{eq:ac:cost}.

Finally, if $\Gamma = \Gamma(s)$ for some $s \in Z$, then $\Gamma$ contributes $M[s, \rho^\ast(\Gamma(s)), f^{\beta,\ast}|_{\sigma(s)}]$
to the sum in~\eqref{eq:ac:cost}. By Point~\ref{i:ac:cmpl}, there exists an extension $f_s$ of $f^{\beta,\ast}|_{\sigma(s)}$ to $V(G_s)$ of cost at most $M[s,\rho^\ast(\Gamma(s)),f^{\beta,\ast}|_{\sigma(s)}]$. By compactness and the fact that $f^{\beta,\ast}|_{\sigma(s)}$ is not a constant function, any such extension has a positive cost in $G_s$. This finishes the proof of the claim.
\renewcommand{\qed}{\cqedsymbol}\end{proof}

Let $A^\ast = (f^{\beta,\ast})^{-1}([p] \setminus \{\mathfrak{j}(f^{\beta,\ast})\})$. Since $f^{\beta,\ast}$ is unbreakable-consistent, we have $|A^\ast| \leq 3k$.
Let $B^\ast$ be the set of all vertices $v \in \beta(t) \setminus A^\ast$ for which there exists a touched constraint
$\Gamma \in \mathcal{C}$ with $v \in X_\Gamma$.
By Claim~\ref{cl:ac:touched}, we have that $|B^\ast| \leq k(k+|I|)$.

Our application of Lemma~\ref{lem:random2} is encapsulated in the following claim.
\begin{claim}\label{cl:ac:random}
In time $2^{\mathcal{O}((k+|I|) \log (k+|I|))} n^{\mathcal{O}(1)}$ one can generate a family $\mathcal{F}$
of pairs $(j,g)$ where $j \in [p]$ and $g \colon \beta(t) \to [p]$.
The family is of size $2^{\mathcal{O}((k+|I|) \log (k+|I|))} n$ and
there exists $(j,g) \in \mathcal{F}$ such that $j = \mathfrak{j}(f^{\beta,\ast})$ and $g$ agrees with $f^{\beta,\ast}$ on
$A^\ast \cup B^\ast$. Furthermore, for every element $(j,g) \in \mathcal{F}$, $g$ extends $f^\sigma$.
\end{claim}
\begin{proof}
First, we iterate over all choices of nonnegative integers $j \in [p]$ and $a_1,a_2, \ldots, a_{p}$
such that $\sum_{i=1}^{p} a_i \leq 3k+k(k+|I|)$ and $\sum_{i \in [p] \setminus \{j\}} a_i \leq 3k$.
Clearly, there are $2^{\mathcal{O}(k)}(|I|+k)$ options as $p \leq k+1$.
For a fixed choice of $j$ and $(a_i)_{i=1}^{p}$ we invoke Lemma~\ref{lem:random2}
for $U = \beta(t) \setminus \sigma(t)$ and integers $r = p$, $(a_i)_{i=1}^{p}$, obtaining a family
$\mathcal{F}'$. For every $g' \in \mathcal{F}'$, we insert $(j, g' \cup f^\sigma)$
  into $\mathcal{F}$.

The bound on the size of the output family $\mathcal{F}$ follows from bound of Lemma~\ref{lem:random2}
and the inequality $\log^k n \leq 2^{\mathcal{O}(k \log k)} n$.
Finally, note that the promised pair $(j,g)$ will be generated for the choice of
$j = \mathfrak{j}(f^{\beta,\ast})$ and $a_i = |(f^{\beta,\ast})^{-1}(i) \cap (A^\ast \cup B^\ast)\setminus \sigma(t)|$ for every $i \in [p]$.
\renewcommand{\qed}{\cqedsymbol}\end{proof}

Invoke the algorithm of Claim~\ref{cl:ac:random}, obtaining a family $\mathcal{F}$. We say
that $(j,g) \in \mathcal{F}$ is \emph{lucky} if $f^{\beta,\ast}$ exists, $j = \mathfrak{j}(f^{\beta,\ast})$, and $f^{\beta,\ast}$
agrees with $g$ on $A^\ast \cup B^\ast$.

Consider now an auxiliary graph $H$ with $V(H) = \beta(t)$ and $uv \in E(H)$ if and only if
$u \neq v$ and there exists a constraint $\Gamma \in \mathcal{C}$ with $u,v\in X_\Gamma$.
By the definition of constraints $\Gamma(e)$, we have that $G_t[\beta(t)]$ is a subgraph of
$H$, but in $H$ we also turn all adhesions $\sigma(s)$ for $s \in Z$ into cliques.

For a pair $(j,g) \in \mathcal{F}$, we define $\Sigma(j,g) := g^{-1}([p] \setminus \{j\})$.
Observe the following.

\begin{claim}\label{cl:ac:stains}
For a lucky pair $(j,g)$,
every connected component of $H[\Sigma(j,g)]$ is either completely contained
in $(f^{\beta,\ast})^{-1}(j)$ or completely contained in $A^\ast$.
\end{claim}
\begin{proof}
Assume the contrary, and let $uv \in E(H)$ be an edge violating the condition. By symmetry, assume $f^{\beta,\ast}(u) \neq j$.
Then, since $(j,g)$ is lucky, we have that $u \in A^\ast$. Hence $v \notin A^\ast$, that is, $f^{\beta,\ast}(v) = j$.
By the definition of $H$, there exists a constraint $\Gamma \in \mathcal{C}$ with $u,v \in X_{\Gamma}$ (either $\Gamma = \Gamma(uv)$ or
$\Gamma = \Gamma(s)$ for some $s \in Z$ with $u,v \in \sigma(s)$). Consequently, $\Gamma$ is touched, and $v \in B^\ast$.
However, then from the fact that $(j,g)$ is lucky it follows that $g(v) = j$, a contradiction.
\renewcommand{\qed}{\cqedsymbol}\end{proof}
Claim~\ref{cl:ac:stains} motivates the following approach. We try every pair $(j,g) \in \mathcal{F}$,
and proceed under the assumption that $(j,g)$ is lucky.
We inspect connected components of $H[\Sigma(j,g)]$ one-by-one and either try to
set a candidate for function $f^{\beta,\ast}$ to be equal to $g$ or constantly equal $j$ on the component.
Claim~\ref{cl:ac:stains} asserts that one could construct $f^{\beta,\ast}$ in this manner.
The definition of $H$ implies that for every constraint $\Gamma \in \mathcal{C}$, the set $X_\Gamma$ intersects at most one component
of $H[\Sigma(j,g)]$. This gives significant
independence of the decisions, allowing us to execute a multidimensional knapsack-type dynamic
programming, as between different connected components of $H[\Sigma(j,g)]$ we need only to keep intermediate values of the
cost and the union of values of the constructed responsibility assignment.

We proceed with formal arguments.
For every $(j,g) \in \mathcal{F}$, we proceed as follows.
Let $C_1,C_2,\ldots,C_\ell$ be the connected components of $H[\Sigma(j,g)]$ and for $1 \leq i \leq \ell$,
let $\mathcal{C}_i$ be the set of constraints $\Gamma \in \mathcal{C}_i$ with
$X_\Gamma \cap C_i \neq \emptyset$.
By the definition of $H$,
  the sets $\mathcal{C}_i$ are pairwise disjoint.
Let $\mathcal{C}_0 = \mathcal{C} \setminus \bigcup_{i=1}^\ell \mathcal{C}_i$ be the remaining constraints, i.e., the constraints $\Gamma \in \mathcal{C}$ with $X_\Gamma \cap \Sigma(j,g) = \emptyset$.
It will be convenient for us to denote $C_0 = \emptyset$ to be a component accompanying
$\mathcal{C}_0$.
For $J \subseteq \{0,1,2,\ldots,\ell\}$, denote $g_J$ to be the function $g$ modified as follows:
for every $i \in \{0,1,\ldots,\ell\} \setminus J$ and every $v \in C_i$ we set $g_J(v) = j$.
Furthermore, let $J^\sigma \subseteq \{1,2,\ldots,\ell\}$ be the set of these indices $j$
for which $C_j \cap \sigma(t) \neq \emptyset$.
For $0 \leq i \leq \ell$, denote $\mathcal{C}_{\leq i} = \bigcup_{j \leq i} \mathcal{C}_j$.

Let $m = |\mathcal{C}|$. We order constraints in $\mathcal{C}$ as $\Gamma_1,\Gamma_2,\ldots,\Gamma_m$
according to which set $\mathcal{C}_i$ they belong to. That is, if $\Gamma_a \in \mathcal{C}_i$,
$\Gamma_b \in \mathcal{C}_j$ and $i < j$, then $a < b$.
For $0 \leq i \leq \ell$,
let $\overrightarrow{a}(i) = |\mathcal{C}_{\leq i}|$, that is, $\Gamma_{\overrightarrow{a}(i)} \in \mathcal{C}_{\leq i}$
but $\Gamma_{\overrightarrow{a}(i)+1}$ does not belong to $\mathcal{C}_{\leq i}$ (if exists).
Furthermore, let $\overrightarrow{a}(-1) = 0$.

Let $0 \leq i \leq \ell$ and let $\overrightarrow{a}(i-1) \leq a \leq \overrightarrow{a}(i)$.
An \emph{$a$-partial responsibility assignment} $\rho$ is a responsibility assignment
defined on constraints $\Gamma_1, \ldots, \Gamma_a$ such that $\bigcup_{b=1}^a \rho(\Gamma_b) \subseteq I$.
For a set $J \subseteq \{0,1,\ldots,i\}$ containing $J^\sigma \cap \{0,1,\ldots,i\}$
and an $a$-partial responsibility assignment $\rho$, we define the cost of $J$ and $\rho$ as
$$\mathfrak{c}_{i,a}(J, \rho) = \sum_{b=1}^a M_{\Gamma_b}(\rho(\Gamma_b), g_J|_{X_{\Gamma_b}}).$$
Furthermore, let $k^\beta = k$ if $|\beta(t)| > 3k$ and $k^\beta = |\beta(t)|$ otherwise.
The goal of our dynamic programming algorithm is to compute, for every $-1 \leq i \leq \ell$, $0 \leq k^\bullet \leq k^\beta$,
 and $I^\bullet \subseteq I$
a value $Q_i[k^\bullet, I^\bullet]$ that equals a minimum possible cost $\mathfrak{c}_{i,\overrightarrow{a}(i)}(J,\rho)$ over all $J \subseteq \{0,1,\ldots,i\}$ containing $J^\sigma \cap \{0,1,\ldots,i\}$ with $|\bigcup_{i' \in J} C_{i'}| \leq k^\bullet$,
and $\overrightarrow{a}(i)$-partial responsibility assignment $\rho$
with $\bigcup_{b=1}^{\overrightarrow{a}(i)} \rho(\Gamma_b) = I^\bullet$.
The next claim shows that it suffices.
\begin{claim}\label{cl:ac:dp}
We have $Q_\ell[k^\beta, I] \geq \mathfrak{c}(\rho^\ast, f^{\beta,\ast})$.
Furthermore, if $\mathfrak{c}(\rho^\ast,f^{\beta,\ast}) \leq k$ and $(j,g)$ is lucky, then
$Q_\ell[k^\beta,I] = \mathfrak{c}(\rho^\ast, f^{\beta,\ast})$.
\end{claim}
\begin{proof}
For the first claim, let $(J, \rho)$ be the witnessing arguments for the value $Q_\ell[k^\beta, I]$.
Note that $\rho$ is a responsibility assignment. Furthermore, $g_J$ is a feasible function: it extends $f^\sigma$
due to the requirement $J^\sigma \subseteq J$ and it is unbreakable-consistent
due to the requirement $|\bigcup_{i' \in J} C_{i'}| \leq k^\beta$.
The first claim follows from the minimality of $(\rho^\ast, f^{\beta,\ast})$.

For the second claim, by Claim~\ref{cl:ac:stains} we know that on every connected component $C_i$,
the function $f^{\beta,\ast}$ either equals $g$ or is constant at $j$.
Let $J^\ast$ be the set where the first option happens; note that $J^\sigma \subseteq J^\ast$
and $g_{J^\ast} = f^{\beta,\ast}$. Consequently, $\mathfrak{c}_{\ell,m}(J^\ast, \rho^\ast) = \mathfrak{c}(\rho^\ast, f^{\beta,\ast})$.
Finally, as $f^{\beta,\ast}$ is unbreakable-consistent, we have $|\bigcup_{i' \in J^\ast} C_{i'}| \leq k^\beta$.
The claim follows from the minimality of $Q_\ell[k^\beta, I]$.
\renewcommand{\qed}{\cqedsymbol}\end{proof}

For the initialization step of our dynamic programming algorithm, note that for $i=-1$
we have $\overrightarrow{a}(i)=0$ and the minimization for $Q_{-1}[\cdot,\cdot]$
takes into account only $J = \emptyset$ and $\rho=\emptyset$.

Fix now $0 \leq i \leq \ell$, we are to compute values $Q_i[\cdot,\cdot]$.
To this end, we use another layer of dynamic programming.
For $\overrightarrow{a}(i-1) \leq a \leq \overrightarrow{a}(i)$, $0 \leq k^\bullet \leq k^\beta$, and $I^\bullet \subseteq I$
we define $Q_{i,a}^\in[k^\bullet, I^\bullet]$ to be a minimum possible cost
$\mathfrak{c}_{i,a}(\rho,J)$ over all $J \subseteq \{0,1,2,\ldots,i\}$ containing
$J^\sigma \cap \{0,1,2,\ldots,i\}$ satisfying that $i\in J$ and
$|\bigcup_{i' \in J} C_{i'}| \leq k^\bullet$, and all $a$-partial responsibility assignments
$\rho$ with $\bigcup_{b=1}^a \rho(\Gamma_b) = I^\bullet$.

Similarly we define $Q_{i,a}^{\notin}[k^\bullet, I^\bullet]$ with the requirement that $i \notin J$.
This definition is applicable only if $i \notin J^\sigma$; for indices $i \in J^\sigma$ we do not compute the
values $Q_{i,a}^{\notin}$.

Since $Q_{i,\overrightarrow{a}(i-1)}^\in$, $Q_{i,\overrightarrow{a}(i-1)}^{\notin}$, and $Q_{i-1}$ use all constraints up to $\overrightarrow{a}(i-1)$,
we have
$$Q_{i,\overrightarrow{a}(i-1)}^\in[k^\beta + |C_i|, I^\bullet] = Q_{i,\overrightarrow{a}(i-1)}^{\notin}[k^\beta, I^\bullet] = Q_{i-1}[k^\beta, I^\bullet].$$
Here, and in subsequent formulae, we assume that a value of a cell $Q_{i,a}^\in[\cdot,\cdot]$
or $Q_i[\cdot,\cdot]$ equals $0$ if the first argument is negative.
The above formula serves as the initialization step for computing values $Q_{i,a}^\in[\cdot,\cdot]$
and $Q_{i,a}^{\notin}[\cdot,\cdot]$.

For a single computation step, fix $\overrightarrow{a}(i-1) < a \leq \overrightarrow{a}(i)$.
The definitions of $Q_{i,a}^\in[\cdot]$ and $Q_{i,a-1}^\in[\cdot,\cdot]$ differ only in the requirement
to define $f(\Gamma_a)$. Furthermore, $X_{\Gamma_a}$ intersects only the component $C_i$
(if $i > 0$), while $i$ is required to be contained in $J$ in the definition
of both $Q_{i,a}^\in[\cdot,\cdot]$ and $Q_{i,a-1}^\in[\cdot,\cdot]$. Consequently,
$$Q_{i,a}^\in[k^\bullet, I^\bullet] = \min_{I' \subseteq I^\bullet} \left(Q_{i,a-1}^\in[k^\bullet, I^\bullet \setminus I'] + M_{\Gamma_a}(I', g|_{X_{\Gamma_a}})\right).$$
  Similarly, for $i \notin J^\sigma$ we have
$$Q_{i,a}^{\notin}[k^\bullet, I^\bullet] = \min_{I' \subseteq I^\bullet} \left(Q_{i,a-1}^{\notin}[k^\bullet, I^\bullet \setminus I'] + M_{\Gamma_a}(I', X_{\Gamma_a} \times \{j\})\right).$$
  Finally, we set for $i \in J^\sigma$:
$$Q_i[k^\bullet, I^\bullet] = Q_{i,\overrightarrow{a}(i)}[k^\bullet, I^\bullet],$$
and for $i \notin J^\sigma$:
$$Q_i[k^\bullet, I^\bullet] = \min \left( Q_{i,\overrightarrow{a}(i)}^\in[k^\bullet, I^\bullet], Q_{i,\overrightarrow{a}(i)}^{\notin}[k^\bullet, I^\bullet]\right)$$

The above dynamic programming algorithm computes the values $Q_\ell[\cdot,\cdot]$ in time $3^{|I|} \cdot n^{\mathcal{O}(1)}$.
By Claims~\ref{cl:ac:feas} and~\ref{cl:ac:dp}, we can take $M[t, I, f^\sigma]$
to be the minimum value of $Q_\ell[k^\beta, I]$ encountered over all choices of $(j,g) \in \mathcal{F}$.
Claim~\ref{cl:ac:M} shows that the above suffices to conclude the proof of Theorem~\ref{thm:auxcut}.
\end{proof}

\subsubsection{Steiner Cut}

\begin{proof}[Proof of Theorem~\ref{thm:steinercut}.]
Let $(G,T,p,k)$ be an input to \textsc{Steiner Cut} and let $n = |V(G)|$.

First, we observe that it is sufficient to solve \textsc{Steiner Cut} with the additional assumption that $G$ is connected.
Indeed, in the general case we can proceed as follows. First, we discard all connected components of $G$
that are disjoint with $T$.
Second, for every connected component $G'$ of $G$ and every $0 \leq k' \leq k$, $0 \leq p' \leq p$, we solve \textsc{Steiner Cut}
on the instance $(G', T \cap V(G'), p', k')$.
Finally, the results of these computations allow us to solve the input instance by a straightforward knapsack-type
dynamic programming algorithm.

Thus, we assume that $G$ is connected. In particular, we can assume that $p \leq k+1$ as otherwise the input
instance is a trivial no-instance.
With these assumptions, it is straightforward to observe that the input \textsc{Steiner Cut} instance $(G,T,p,k)$
is equivalent to \textsc{Auxiliary Cut} instance $(G,p,k,(T),\{1\} \times [p])$, that is, we set $\tau = 1$,
   $T_1 = T$, and $I = \{1\} \times [p]$. Theorem~\ref{thm:steinercut} follows.
\end{proof}

\subsubsection{Steiner Multicut}

\begin{proof}[Proof of Theorem~\ref{thm:multicut}.]
Let $(G,(T_i)_{i=1}^t,k)$ be an input to \textsc{Steiner Multicut} and let $n = |V(G)|$.

First, we observe that it is sufficient to solve \textsc{Steiner Multicut} with the additional assumption that $G$ is connected.
Indeed, in the general case we can proceed as follows. First, we discard all sets $T_i$ that intersect more than one connected component of $G$. Second, for every connected component $G'$ of $G$ and every $0 \leq k' \leq k$, we solve \textsc{Steiner Multicut}
on graph $G$, terminal sets $\{T_i~|~T_i \subseteq V(G')\}$, and budget $k'$.
Finally, the results of these computations allow us to solve the input instance by a straightforward knapsack-type
dynamic programming algorithm.
Thus, henceforth we assume that $G$ is connected.
In particular, any function $f : V(G) \to \mathbb{Z}$ of cost at most $k$ can attain at most $k+1$ distinct values. Let $p = k+1$.

If $G$ is connected, then the input \textsc{Steiner Multicut} instance $(G,(T_i)_{i=1}^t,k)$ is a yes-instance
if and only if there exists $f \colon V(G) \to [p]$ of cost at most $k$ such that for every $i \in [t]$, $f$ is not constant on $T_i$.
Thus, to reduce \textsc{Steiner Multicut} to \textsc{Auxiliary Multicut}, it suffices to guess, for every $i \in [t]$, two distinct values from $[p]$ than $f$ attains on $T_i$.

More formally, we iterate over all sequences $(M_i)_{i=1}^t$ such that for every $i \in [t]$ we have $M_i \subseteq [p]$
and $|M_i| = 2$. There are $2^{\mathcal{O}(t \log t)}$ such sequences.
For every sequence $(M_i)_{i=1}^t$ we define $I = \bigcup_{i=1}^t \{i\} \times M_i$ and invoke
the algorithm of Theorem~\ref{thm:auxcut} for \textsc{Auxiliary Cut} instance $(G,p,k,(T_i)_{i=1}^t,I)$.
By the discussion above, the input \textsc{Steiner Multicut} instance is a yes-instance if and only
if at least one of the generated \textsc{Auxiliary Cut} instances is a yes-instance.
Since in every call we have $|I| = 2t$, Theorem~\ref{thm:multicut} follows.
\end{proof}

\section{Conclusions}

In this paper we presented an algorithm that constructs a tree decomposition as in~\cite{minbisection-STOC}, but faster, with better parameter bounds, and arguably simpler.
This allowed us to improve the parametric factor in the running time bounds for a number of parameterized algorithms for cut problems to $2^{\mathcal{O}(k \log k)}$.
We conclude with a few open questions.

First, can we construct the decomposition as in this paper in time $2^{\mathcal{O}(k)} n^{\mathcal{O}(1)}$? The current techniques seem to fall short of this goal.

The problem of finding a lean witness for a bag that is not $(k,k)$-unbreakable can be generalized to the following {\sc{Densest Subhypergraph}} problem:
given a hypergraph $H=(V,E)$, where the same hyperedge may appear multiple times (i.e. it is a multihypergraph), and an integer $k$,
one is asked to find a set $X\subseteq V$ consisting of $k$ vertices that maximizes the number of hyperedges contained in $X$.
A trivial approximation algorithm
is to just find the hyperedge of size at most $k$ that has the largest multiplicity and cover it; this achieves the approximation factor of $2^k$.
We conjecture that it is not possible to obtain a $2^{o(k)}$-approximation in FPT time for this problem.

Third, we are not aware of any conditional lower bounds for \textsc{Minimum Bisection} that are even close to our $2^{\mathcal{O}(k \log k)} n^{\mathcal{O}(1)}$ upper bound.
To the best of our knowledge, even an algorithm with running time $2^{o(k)}\cdot n^{\mathcal{O}(1)}$ is not excluded under the Exponential Time Hypothesis using the known {\sc{NP}}-hardness reductions.
It would be interesting to understand to what extent the running time of our algorithm is optimal.

\section{Constructing a lean decomposition: Proof of Theorem~\ref{thm:decomp}}\label{s:lean}

\subsection{Refinement step}

Bellenbaum and Diestel~\cite{BellenbaumD02} defined an improvement step that, given a tree
decomposition and a lean witness, refines the decomposition so that it is in some sense
closer to being lean. We will use the same refinement step, but only for the special single bag case. Hence, in subsequent sections we
focus on finding a single bag lean witness in a current candidate tree decomposition.
The following observation is a direct consequence of Menger's theorem.

\begin{claim}
\label{claim:equiv}
For a tree decomposition $(T,\beta)$, a node $s \in T$, and subsets $Z_1,Z_2 \subseteq \beta(s)$ with $|Z_1|=|Z_2|$,
the following two conditions are equivalent:
\begin{itemize}
  \item $(s,s,Z_1,Z_2)$ is a single bag lean witness for $(T,\beta)$,
  \item there is a separation $(A_1,A_2)$ of $G$ and a set of vertex disjoint $Z_1-Z_2$ paths $\{P_x\}_{x \in X}$, where $X = A_1 \cap A_2$,
  such that $Z_i \subseteq A_i$ for $i\in \{1,2\}$, $|X| < |Z_1|$, and $x \in V(P_x)$ for every $x \in X$.
\end{itemize}
Moreover given a single bag lean witness $(s,s,Z_1,Z_2)$ one can find the above separation $(A_1,A_2)$ and set of paths $\{P_x\}_{x \in X}$ in polynomial time.
\end{claim}
The minimum order of a separation from the second point of Claim~\ref{claim:equiv} is called the {\em{order}}
of the single bag lean witness $(s,s,Z_1,Z_2)$.

To argue that the refinement process stops after a small number of steps, or that it stops
at all, we define a potential for a graph $G$, a tree decomposition $(T,\beta)$, and an integer $k$
as follows.
\begin{align}
\Phi^1_{G,k}(T, \beta) & = \sum_{t \in T} \max(0, |\beta(t)|-2k-1) \\
\Phi^2_{G,k}(T, \beta) & = \sum_{t \in T} (2^{\min(|\beta(t)|, 2k+1)}-1) \\
\Phi_{G,k}(T, \beta) &= 2^{2k+1} (n+1) \Phi^1_{G,k}(T, \beta) + \Phi^2_{G,k}(T, \beta).
\end{align}
Note that if $T$ has at most $n+1$ bags, then $\Phi_{G,k}(T, \beta)$ is order-equivalent to
the lexicographical order of $(\Phi^1_{G,k}(T, \beta), \Phi^2_{G,k}(T, \beta))$.
Also note that this potential is different from the one used by Bellenbaum and Diestel in~\cite{BellenbaumD02}:
the potential of~\cite{BellenbaumD02} can be exponential in $n$ while being oblivious to the cut
size $k$.

Given a witness, a single refinement step we use is encapsulated in the following lemma, which is essentially a repetition
of the refinement process of~\cite{BellenbaumD02} with the analysis of the new potential.
We emphasize that in this part, all considered tree decompositions are unrooted.

\begin{lemma}\label{lem:vertex-refine}
Assume we are given a graph $G$, an integer $k$, a tree decomposition $(T, \beta)$ of $G$
with every adhesion of size at most $k$, a node $s \in T$, and
a single bag lean witness $(s,s,Z_1,Z_2)$ with $|Z_1| \le k+1$.
Then one can in polynomial time compute a tree decomposition $(T',\beta')$ of $G$
with every adhesion of size at most $k$ and having at most $n+1$ bags
such that $\Phi_{G,k}(T,\beta) > \Phi_{G,k}(T',\beta')$.
\end{lemma}
\begin{proof}
Apply Claim~\ref{claim:equiv}, yielding a separation $(A_1,A_2)$ and a family $\{P_x\}_{x \in X}$ of vertex disjoint $Z_1-Z_2$ paths, where $X=A_1\cap A_2$.
Note that $k+1 \ge |Z_1| > |X|$, hence the order of $(A_1,A_2)$ is at most $k$.
For every $x \in X$, the path $P_x$ is split by $x$ into two subpaths $P_x^i$, $i=1,2$, each leading from $Z_i$ to $x$.
Note that $V(P_x^i) \setminus \{x\} \subseteq A_i \setminus A_{3-i}$ for $i=1,2$.

We construct a tree decomposition $(T',\beta')$ as follows.
First for every $i = 1,2$, we construct a decomposition $(T^i,\beta^i)$ of $G[A_i]$:
we start with $T^i$ being a copy of $T$, where a node $t \in V(T)$ corresponds
to a node $t^i \in V(T^i)$, and we set $\beta^i(t^i) := \beta(t) \cap A_i$ for every $t \in V(T)$.
Then for every $x \in X \setminus \beta(s)$ we take the node $t_x \in V(T)$ such that $x \in \beta(t_x)$ and $t_x$
is the closest to $s$ in $T$ among such nodes, and insert $x$ into every bag $\beta^i(t^i)$ for $t^i$
lying on the path between $s^i$ (inclusive) and $t_x^i$ (exclusive) in $T^i$.

Clearly, $(T^i,\beta^i)$ is a tree decomposition of $G[A_i]$ and $X \subseteq \beta^i(s^i)$.
We construct $(T^\circ,\beta^\circ)$ by taking $T^\circ$ to be the disjoint union of $T^1$ and $T^2$, with
the copies of the node $s$ connected by an edge $s^1s^2$, and $\beta^\circ := \beta^1 \cup \beta^2$.
Since $(A_1,A_2)$ is a separation and $X = A_1 \cap A_2$ is present in both bags $\beta^1(s^1)$, $\beta^2(s^2)$, we infer
that $(T^\circ,\beta^\circ)$ is a tree decomposition of $G$.

Finally, we apply the cleanup procedure to $(T^\circ,\beta^\circ)$, thus obtaining the final tree decomposition $(T',\beta')$ where $T'$ has at most $n$ edges.
From the properties of the separation $(A_1,A_2)$ we infer that $\beta^i(s^i) \subsetneq \beta(s)$ and
$\beta^i(s^i) \not\subseteq A_{3-i}$ for $i=1,2$. In particular, the edge $s^1s^2$ is not contracted during the cleanup
and in $(T',\beta')$ the adhesion of the edge $s^1s^2$ is exactly $X$, which is of size at most $k$.

Consider now a node $t^i$ in the tree decomposition $(T^i,\beta^i)$. The set $\beta^i(t^i) \setminus \beta(t)$
consists of some vertices of $X$, namely those vertices $x \in X \setminus \beta(s)$ for which $t$
lies on the path between $s$ (inclusive) and $t_x$ (exclusive).
On the other hand, by the properties of a tree decomposition, $\beta(t)$ contains at least one vertex of $V(P_x^{3-i})\setminus\{x\} \subseteq A_{3-i} \setminus A_i$.
This vertex is not present in $A_i$, hence it is also not present in $\beta^i(t^i)$.
We conclude that $|\beta^i(t^i)\setminus \beta(t)|\leq |\beta(t)\setminus \beta^i(t^i)|$, implying $|\beta^i(t^i)| \leq |\beta(t)|$.
The same argumentation can be applied to every edge $e^i \in E(T^i)$ and adhesion of this edge, showing that $|\sigma^i(e^i)|\leq |\sigma(e)|$.

We infer that every adhesion of $(T^\circ,\beta^\circ)$ (and thus also of $(T',\beta')$) is of size at most $k$.
We are left with analysing the potential decrease.  We make an auxiliary claim.

\begin{claim}
  The first part of the potential is non-increasing, i.e.,
  $\Phi^1_{G,k}(T, \beta) \geq \Phi^1_{G,k}(T', \beta')$.
  Furthermore, if $|\beta(t)| > \max(|\beta^1(t^1)|, |\beta^2(t^2)|)$ for any $t \in V(T)$
  with $|\beta(t)|>2k+1$, then $\Phi_{G,k}^1(T, \beta) > \Phi_{G,k}^1(T', \beta')$.
\end{claim}
\begin{proof}
  It suffices to show that this holds for $(T^\circ,\beta^\circ)$, as the cleanup operation does not increase any of the parts of the potential.
  Fix $t \in V(T)$. We analyse the difference between the contribution to the potential
  of $t$ in $(T,\beta)$ and the copies of $t$ in $(T^\circ,\beta^\circ$).
  First, we have already argued that $|\beta^i(t^i)| \leq |\beta(t)|$
  for $i=1,2$. Consequently, if $|\beta(t)| \leq 2k+1$, then $|\beta^i(t^i)| \leq 2k+1$ for $i=1,2$
  and the discussed contributions are all equal to~$0$.
  Furthermore, if $|\beta^i(t^i)| \leq 2k+1$ for some $i=1,2$, then $\max(|\beta^{i}(t^{i})|-2k-1,0)=0$ and
  $\max(|\beta(t)|-2k-1,0) \geq \max(|\beta^{3-i}(t^{3-i})|-2k-1,0)$ due to
  $|\beta^{3-i}(t^{3-i})| \leq |\beta(t)|$, yielding the claim.

  Otherwise, assume that $|\beta(t)| > 2k+1$ and $|\beta^i(t^i)| > 2k+1$ for $i=1,2$.
  Note that $\beta^1(t^1) \cup \beta^2(t^2) \subseteq \beta(t) \cup X$
  while $\beta^1(t^1) \cap \beta^2(t^2) \subseteq X$ and $|X| \leq k$.
  Consequently,
  \begin{align}
    |\beta(t)|-2k-1 &\geq |\beta(t) \setminus A_2| + |\beta(t) \setminus A_1| - 2k-1\nonumber \\
                    &\geq |(\beta(t) \setminus A_2) \cup X| + |(\beta(t) \setminus A_1) \cup X| - 4k-1\label{eq:raccoon} \\
                    &> |\beta^1(t^1)| -2k-1 + |\beta^2(t^2)| -2k-1.\nonumber
  \end{align}
  We infer that for every bag $t \in V(T)$, the contribution of $t$ to the potential
  $\Phi^1_{G,k}(T,\beta)$ is not smaller than the contribution of the two copies of $t$
  in $\Phi^1_{G,k}(T^\circ,\beta^\circ)$.

  Finally, assume that $|\beta(t)| > \max(|\beta^1(t^1)|, |\beta^2(t^2)|)$ and $|\beta(t)| > 2k+1$.
  If $|\beta^i(t^i)| > 2k+1$ for $i=1,2$, then by~\eqref{eq:raccoon} the potential $\Phi^1$ decreases, so assume (w.l.o.g.) that $|\beta^2(t^2)| \leq 2k+1$.
  Then $t^2$ contributes nothing to $\Phi^1_{G,k}(T^\circ, \beta^\circ)$, while
  the contribution of $t^1$ to $\Phi^1_{G,k}(T^\circ, \beta^\circ)$ is strictly smaller than
  the contribution of $t$ to $\Phi^1_{G,k}(T, \beta)$.
\renewcommand{\qed}{\cqedsymbol}\end{proof}

We proceed with the proof.
Note that since both $T$ and $T'$ have at most $n+1$ vertices due to the cleanup step
$\Phi^1_{G,k}(T, \beta) > \Phi^1_{G,k}(T', \beta')$ entails $\Phi_{G,k}(T, \beta) > \Phi_{G,k}(T', \beta')$.
Hence, in the remainder we assume that for every $t \in V(T)$ with $|\beta(t)|>2k+1$
we have $\max_{i=1, 2} |\beta^i(t^i)|=|\beta(t)|$.
We argue that in this case, one of $t^1$ and $t^2$ disappears in cleanup.
Let $t \in V(T)$ be arbitrary with $|\beta(t)|>2k+1$, and assume
w.l.o.g.\ that $|\beta(t)| = |\beta^1(t^1)|$.
This in particular implies that $s \neq t$.

Let $X' = \beta^1(t^1) \setminus \beta(t)$; note that $X' \subseteq X$.
Recall that for every $x \in X'$ the bag $\beta(t)$ contains at least one vertex of $V(P_x^2) \setminus \{x\} \subseteq A_2 \setminus A_1$ which is no longer present in $\beta^1(t^1)$.
Since $|\beta(t)| = |\beta^1(t^1)|$, $\beta(t)$
contains  exactly one vertex $v_x$ of $V(P_x^2) \setminus \{x\}$ for every $x \in X'$
and
$$\beta^2(t^2) = (\beta(t) \cap X) \cup \{v_x\colon x \in X'\}.$$
Let $t_\circ$ be the neighbor of $t$ that lies on the path from $t$ to $s$ in $T$.
Fix $x \in X'$; we claim that $v_x \in \beta(t_\circ)$.
This is clear if $v_x \in Z_2$ is the endpoint of $P_x^2$, because then $v_x\in \beta(s)\cap \beta(t)\subseteq \beta(t_\circ)$. Otherwise, let $w_x$ be the neighbor of $v_x$ on $P_x^2$ in the direction of the endpoint in $Z_2$.
Since $v_x$ is the only vertex of $V(P_x^2) \setminus \{x\}$ in $\beta(t)$, while the endpoint of $P_x^2$ belonging to $Z_2$ lies in $\beta(s)$,
$w_x$ belongs to a bag at a node $t'$ of $T$ that lies on the path between $t$ and $s$ in $T$.
As $w_x\notin \beta(t)$ while $v_x$ and $w_x$ are adjacent, we infer that $v_x \in \beta(t_\circ)$, as desired.
Since $v_x\in A_2$, this entails $v_x\in \beta^2(t_\circ^2)$.

The argumentation of the previous paragraph shows that $\{v_x\colon x\in X'\}\subseteq \beta^2(t_\circ^2)$.
On the other hand, from the construction we directly have $\beta(t) \cap X \subseteq \beta^2(t_\circ^2)$.
Thus $\beta^2(t^2) \subseteq \beta^2(t_\circ^2)$ and $t^2$ disappears in the cleanup procedure.
Hence, its contribution to $\Phi_{G,k}(T', \beta')$ can be ignored.

Finally, we claim that under these conditions, $\Phi^2_{G,k}(T, \beta) > \Phi^2_{G,k}(T', \beta')$.
Take any $t \in V(T)$.
If either $t^1$ or $t^2$ disappears in $T'$, then the contribution of $t$ to $\Phi^2_{G,k}(T, \beta)$ is not smaller than the total contribution of $t^1$ and $t^2$ to $\Phi^2_{G,k}(T', \beta')$.
Hence, suppose that both $t^1$ and $t^2$ remain in $T'$.
Letting $\ell=|\beta(t)|$, by the assumption we have $\ell \leq 2k+1$ and the contribution
of $t$ to $\Phi^2_{G,k}(T,\beta)$ is equal to  $2^\ell-1$. On the other hand, since $\max_{i=1, 2} |\beta^i(t^i)|<|\beta(t)|$,
the total contribution of $t^1$ and $t^2$ to $\Phi^2_{G,k}(T', \beta')$ is
at most $2 \cdot (2^{\ell-1}-1) = 2^\ell - 2$, which is strictly smaller than $2^{\ell}-1$.
Since (as noted) $|\beta^i(s^i)| < |\beta(s)|$ for $i=1,2$, both $s^1$ and $s^2$ remain in $T'$, so
it follows that $\Phi_{G,k}(T, \beta) > \Phi_{G,k}(T', \beta')$.
\end{proof}

\subsection{Finding lean witness}\label{s:vertex}

\input{decomposition-new}

\subsection{The algorithm}

With Lemma~\ref{lem:separations} established, we now complete the proof of
Theorem~\ref{thm:decomp}.

\begin{proof}[Proof of Theorem~\ref{thm:decomp}.]
First, we can assume that $G$ is connected, as otherwise we can compute a tree decomposition
for every component separately, and then glue them up in an arbitrary fashion.

We start with a naive unrooted tree decomposition $(T,\beta)$ that has a single node whose bag is the entire vertex set.
Then we iteratively improve it using Lemma~\ref{lem:vertex-refine},
until it satisfies the conditions of Theorem~\ref{thm:decomp}, except for compactness,
      which we will handle in the end.
We maintain the invariant that every adhesion of $(T,\beta)$ is of size at most $k$.
At every step the potential $\Phi_{G,k}(T, \beta)$ will decrease, leading to at most
$\Phi_{G,k}(T,\beta)=\mathcal{O}(4^kn^2)$ steps of the algorithm.

Let us now elaborate on a single step of the algorithm.
There is one reason why $(T,\beta)$ may not satisfy
the conditions of Theorem~\ref{thm:decomp}: namely, it contains a bag that is not $(i,i)$-unbreakable for some $1 \leq i \leq k$.

Consider a bag $S := \beta(t)$ that is not $(i,i)$-unbreakable for some $1 \leq i \leq k$.
Since every adhesion of $(T,\beta)$ is of size at most $k$, we have
that for every connected component $D$ of $G-S$ it holds that $|N_G(D)| \leq k$.
Consequently, Lemma~\ref{lem:separations} allows us to find a single-bag lean witness of order
at most $k$ for the node $t$
in time $2^{\mathcal{O}(k \log k)}\cdot n^{\mathcal{O}(1)}$.

Suppose we uncovered a single-bag lean witness for the node $t$.
Then we may refine the decomposition by applying Lemma~\ref{lem:vertex-refine}, and proceed iteratively with the refined decomposition.
As asserted by Lemma~\ref{lem:vertex-refine}, the potential $\Phi_{G,k}(T,\beta)$ strictly decreases in each iteration,
while the number of edges in the decomposition is always upper bounded by $n$

Observe that the potential $\Phi_{G,k}(T,\beta)$ is always upper bounded by $2^{\mathcal{O}(k)} \cdot n^{\mathcal{O}(1)}$
and every iteration can be executed in time $2^{\mathcal{O}(k\log k)}\cdot n^{\mathcal{O}(1)}$.
Hence, we conclude that the refinement process finishes within the claimed time complexity and outputs an unrooted tree decomposition $(T,\beta)$
that satisfies all the requirements of Theorem~\ref{thm:decomp}, except for being compact.
This can be remedied by applying the algorithm of Lemma~\ref{lem:compactification}.
Note that neither the unbreakability of bags nor the upper bound on the sizes of adhesions can deteriorate as a result of applying the algorithm of Lemma~\ref{lem:compactification},
as every bag (resp. every adhesion) of the obtained tree decomposition is a subset of a bag (resp. an adhesion) of the original one.
\end{proof}

\section{Introduction}

Since the pioneering work of Marx~\cite{Marx06},
the study of graph separation problems has been a large and live subarea of parameterized complexity.
It led to the development of many interesting algorithmic techniques, including
important separators and shadow removal~\cite{ChenLLOR08,dir-mwc,LokshtanovM13,MarxR14,RazgonO09},
branching algorithms based on half-integral relaxations~\cite{mwc-a-lp,sylvain,Iwata17,magnus,IwataYY17},
matroid-based algorithms for preprocessing~\cite{ms2,ms1}, the treewidth reduction technique~\cite{MarxOR13},
and, what is the most relevant for this work, the framework of randomized contractions~\cite{randcontr,KT11}.

The work of Marx~\cite{Marx06} left a number of fundamental questions open, including the parameterized complexity
of the \textsc{$p$-Way Cut} problem: given a graph $G$ and integers $p$ and $k$, can one delete at most $k$
edges from $G$ to obtain a graph with at least $p$ connected components?
We remark that it is easy to reduce the problem to the case when $G$ is connected and $p \leq k+1$.
Marx proved $\mathsf{W}[1]$-hardness of the vertex-deletion variant of the problem, but the question about fixed-parameter tractability of the edge-deletion
variant remained open until Kawarabayashi and Thorup settled it in affirmative in 2011~\cite{KT11}.

In their algorithm, Kawarabayashi and Thorup introduced a useful recursive scheme.
For a graph $G$, an \emph{edge cut} is a pair $A, B \subseteq V(G)$ such that $A \cup B = V(G)$ and $A \cap B = \emptyset$.
The {\em{order}} of an edge cut $(A,B)$ is $|E(A,B)|$.
Assume one discovers in the input graph $G$ an edge cut $(A,B)$ of order at most $k$ such that
both $|A|$ and $|B|$ are large; say $|A|,|B| > q$ for some parameter $q$ to be fixed later.
Then one can recurse on one of the sides, say $A$, in the following manner.
For every behavior of the problem on the set $N(B)$ --- in the context of \textsc{$p$-Way Cut},
for every assignment of the vertices of $N(B)$ into $p$ target components ---
one recurses on an annotated version of the problem to find a minimum-size partial solution in $G[A]$.
Since $|N(B)|$ is bounded by the order of the edge cut $(A,B)$, there is only bounded in $k$ number
of behaviors to consider. Thus, if $q$ is larger than the number of behaviors times $k$ (which is still a function of $k$
only), there is an edge
that is \emph{not used} in any of the found minimum partial solutions. Such an edge can be safely contracted
and the algorithm is restarted.

It remains to show how to find such an edge cut $(A,B)$ and how the algorithm should work in the absence of such a cut.
Since the absence of such balanced cuts is a critical notion in this work, we make the following definitions
that take into account vertex cuts as well. Here, a pair $(A,B)$ of vertex subsets in a graph $G$ is a {\em{separation}}
if $A\cup B=V(G)$ and there is no edge with one endpoint in $A\setminus B$ and the other in $B\setminus A$; the {\em{order}} of the separation $(A,B)$ is $|A\cap B|$.

\begin{definition}[unbreakability]
Let $G$ be a graph.
A vertex subset $X \subseteq V(G)$ is \emph{$(q,k)$-unbreakable} if every separation $(A,B)$ of order at most $k$
satisfies $|A \cap X| \leq q$ or $|B \cap X| \leq q$.\footnote{Note that this definition of a
  $(q,k)$-unbreakable set is stronger than the one used in~\cite{minbisection-STOC} (and in a previous
  version of the present paper). In that definition, which we may call \emph{weakly $(q,k)$-unbreakable},
  it is only required that $|(A \setminus B) \cap X| \leq q$ or $|(B \setminus A) \cap X| \leq q$.
  To illustrate the difference, consider the case where $X=V(G)$. Then testing whether $X$ is
  $(k,k)$-unbreakable reduces to testing whether $G$ is $k+1$-connected, whereas testing
  whether $X$ is weakly $(k,k)$-unbreakable is as hard as the \textsc{Hall Set} problem, and
  thus W[1]-hard~\cite{GaspersKOSS12}. Thus, the present version is more suitable for Theorem~\ref{thm:decomp}.}
A vertex subset $Y \subseteq V(G)$ is \emph{$(q,k)$-edge-unbreakable} if every edge cut $(A,B)$ of order at most $k$
satisfies $|A \cap Y| \leq q$ or $|B \cap Y| \leq q$.
\end{definition}
\noindent Observe that every set that is $(q,k)$-unbreakable is also $(q,k)$-edge-unbreakable.

Hence, the leaves of the recursion of Kawarayashi and Thorup deal with graphs $G$ where $V(G)$ is $(q,k)$-edge-unbreakable.
The algorithm of~\cite{KT11} employs involved arguments originating in the graph minor theory both to deal with this case
and to find the desired edge cut $(A,B)$ for recursion. These arguments, unfortunately, imply a large overhead in the
running time bound and are problem-specific.

A year later, Chitnis et al.~\cite{randcontr-FOCS,randcontr} replaced the arguments based on the graph minor theory with steps
based on \emph{color coding}: a simple yet powerful algorithmic technique introduced by Alon, Yuster, and Zwick in 1995~\cite{AlonYZ95}.
This approach is both arguably simpler and leads to better running time bounds.
Furthermore, the general methodology of~\cite{randcontr} --- dubbed \emph{randomized contractions} --- turns out to be more generic
and can be applied to solve such problems as \textsc{Unique Label Cover}, \textsc{Multiway Cut-Uncut}~\cite{randcontr},
or \textsc{Steiner Multicut}~\cite{BringmannHML16}.
All the abovementioned algorithms have running time bounds of the order of $2^{\mathrm{poly}(k)} \mathrm{poly}(n)$
with both notions of $\mathrm{poly}$ hiding quadratic or cubic polynomials.
Later, Lokshtanov et al.~\cite{LokshtanovR0Z18} showed how the idea of randomized contractions can be applied to give a reduction
for the {\sc{CMSO}} model-checking problem from general graphs to highly connected graphs.

While powerful, the randomized contractions technique seemed to be one step short of providing
a parameterized algorithm for the \textsc{Minimum Bisection} problem, which was an open problem at that time.
In this problem, given a graph $G$ and an integer $k$, one asks for an edge cut $(A,B)$ of order at most $k$
such that $|A|=|B|$.
The only step that fails is the recursive step itself: the number of possible behaviors of the problem on an edge cut
of small order is unbounded by a function of $k$, as the description of the behavior needs to include some indicator of the balance
between the number of vertices assigned to the sides $A$ and $B$.
This problem has been circumvented by a subset of the current authors in 2014~\cite{minbisection-STOC}
by replacing the recursive strategy with a dynamic programming algorithm on an appropriately constructed tree decomposition.
To properly describe the contribution, we need some more definitions.

A \emph{tree decomposition} of a graph $G$ is a pair $(T,\beta)$ where $T$ is a tree and $\beta$ is a mapping that assigns to every $t \in V(T)$
a set $\beta(t) \subseteq V(G)$, called a \emph{bag}, such that the following holds: (i) for every $e \in E(G)$ there exists $t \in V(T)$ with $e \subseteq \beta(t)$, and (ii)
for every $v \in V(G)$ the set $\beta^{-1}(v) := \{t \in V(T) \colon v \in \beta(t)\}$ induces a connected nonempty subgraph of $T$.

For a tree decomposition $(T,\beta)$ fix an edge $e = tt' \in E(T)$. The deletion of $e$ from $T$ splits $T$ into two trees $T_1$ and $T_2$, and naturally induces a separation $(A_1,A_2)$ in $G$
with $A_i := \bigcup_{t \in V(T_i)} \beta(t)$, which we henceforth call \emph{the separation associated with $e$}.
The set $\sigma_{T,\beta}(e) := A_1 \cap A_2 = \beta(t) \cap \beta(t')$ is called the \emph{adhesion} of $e$.
We suppress the subscript if the decomposition is clear from the context.

Some of our tree decompositions are rooted, that is, the tree $T$ in a tree decomposition $(T,\beta)$
is rooted at some node $r$.
For $s,t \in V(T)$ we say that \emph{$s$ is a descendant of $t$}
or that \emph{$t$ is an ancestor of $s$} if $t$ lies on the unique path from $s$ to the root;
note that a node is both an ancestor and a descendant of itself.
For a node $t$ that is not a root of~$T$, by $\sigma_{T,\beta}(t)$ we mean
the adhesion $\sigma_{T,\beta}(e)$ where $e$ is the edge connecting $t$ with its parent in $T$.
We extend this notation to $\sigma_{T,\beta}(r) = \emptyset$ for the root $r$.
Again, we omit the subscript if the decomposition is clear from the context.

We define the following functions for convenience:
\begin{align*}
\gamma(t) &= \bigcup_{s:\textrm{\ descendant\ of\ }t} \beta(s), &
\alpha(t) &= \gamma(t) \setminus \sigma(t), &
G_t &= G[\gamma(t)] - E(G[\sigma(t)]).
\end{align*}
We say that a rooted tree decomposition $(T,\beta)$ of $G$ is \emph{compact}
if for every node $t \in V(T)$ for which $\sigma(t) \neq \emptyset$ we have
that $G[\alpha(t)]$ is connected and $N_G(\alpha(t)) = \sigma(t)$.

The main technical contribution of~\cite{minbisection-STOC} is an algorithm that, given a graph $G$
and an integer $k$, computes a tree decomposition of $G$ with the following properties: (i) the size
of every adhesion is bounded by a function of $k$, and (ii) every bag of the decomposition is $(q,k)$-unbreakable.
In~\cite{minbisection-STOC}, the construction relied on involved arguments using the framework of important separators
and, in essence, also shadow removal. This led to bounds of the form $2^{\mathcal{O}(k)}$ on the obtained value of $q$ and on the sizes of adhesions.
The construction algorithm had a running time bound of $2^{\mathcal{O}(k^2)} n^2 m$.

\paragraph*{Our results}
The main technical contribution of this paper is an improved construction algorithm of a decomposition with the aforementioned properties.
\begin{theorem}\label{thm:decomp}\label{thm:decomposition}
Given an $n$-vertex graph $G$ and an integer $k$, one can in time $2^{\mathcal{O}(k \log k)} n^{\mathcal{O}(1)}$ compute a rooted compact tree decomposition $(T,\beta)$ of $G$
such that
\begin{enumerate}
\item every adhesion of $(T,\beta)$ is of size at most $k$;
\item every bag of $(T,\beta)$ is $(i,i)$-unbreakable in $G$ for every $1 \leq i \leq k$.
\end{enumerate}
\end{theorem}
\noindent Note that since every bag of the output decomposition $(T,\beta)$ is $(k,k)$-unbreakable, it is also $(k,k)$-edge-unbreakable.

The main highlights of Theorem~\ref{thm:decomp} is the improved dependency on $k$ in the running time bound
and the best possible bounds both for the unbreakability and for the adhesion sizes. These improvements have direct consequences for algorithmic applications:
they allow us to develop $2^{\mathcal{O}(k \log k)} n^{\mathcal{O}(1)}$-time parameterized algorithms for a number
of problems that ask for an edge cut of order at most $k$, with the most prominent one being \textsc{Minimum Bisection}.
That is, all applications mentioned below consider edge deletion problems and in their proofs we rely only on $(k,k)$-edge-unbreakability of the bags.

\begin{theorem}\label{thm:bisection}
\textsc{Minimum Bisection} can be solved in time
$2^{\mathcal{O}(k \log k)} n^{\mathcal{O}(1)}$.
\end{theorem}

This improves the parametric factor of the running time from $2^{\mathcal{O}(k^3)}$, provided in~\cite{minbisection-STOC}, to $2^{\mathcal{O}(k\log k)}$.

In our second application, the \textsc{Steiner Cut} problem, we are given an undirected graph $G$, a set $T \subseteq V(G)$ of terminals, and integers $k,p$.
The goal is to delete at most $k$ edges from $G$ so that $G$ has at least $p$ connected components containing
at least one terminal. This problem generalizes \textsc{$p$-Way Cut} that corresponds to the case $T=V(G)$.
\begin{theorem}\label{thm:steinercut}
\textsc{Steiner Cut} can be solved in time $2^{\mathcal{O}(k \log k)} n^{\mathcal{O}(1)}$.
\end{theorem}

This improves the parametric factor of the running time from $2^{\mathcal{O}(k^2\log k)}$, provided in~\cite{randcontr}, to $2^{\mathcal{O}(k\log k)}$.

In the \textsc{Steiner Multicut}
problem we are given an undirected graph $G$, $t$ sets of terminals $T_1,T_2,\ldots,T_t$, each of size at most $p$,
   and an integer $k$. The goal is to delete at most $k$ edges from $G$ so that every terminal set $T_i$ is separated:
   for every $1 \leq i \leq t$, there does not exist a single connected component of the resulting graph that contains the
   entire set $T_i$.
Note that for $p=2$, the problem becomes the classic \textsc{Edge Multicut} problem.
Bringmann et al.~\cite{BringmannHML16} showed an FPT algorithm for \textsc{Steiner Multicut} when parameterized by $k+t$.
We use our decomposition theorem to improve the exponential part of the running time of this algorithm.
\begin{theorem}\label{thm:multicut}
\textsc{Steiner Multicut} can be solved in time $2^{\mathcal{O}((t + k) \log (k + t))} n^{\mathcal{O}(1)}$.
\end{theorem}

This improves the parametric factor of the running time from $2^{\mathcal{O}(k^2t\log k)}$, provided in~\cite{BringmannHML16}, to $2^{\mathcal{O}((t+k)\log (t+k))}$.

\paragraph*{Our techniques}
Our starting point is the definition of a lean tree decomposition of Thomas~\cite{Thomas90}; we follow the formulation of~\cite{BellenbaumD02}.
\begin{definition}
A tree decomposition $(T,\beta)$ of a graph $G$ is called \emph{lean} if for every $t_1,t_2 \in V(T)$
and all sets $Z_1 \subseteq \beta(t_1)$ and $Z_2 \subseteq \beta(t_2)$ with $|Z_1| = |Z_2|$, either
$G$ contains $|Z_1|$ vertex-disjoint $Z_1-Z_2$ paths, or there exists an edge $e \in E(T)$ on the path from $t_1$ to $t_2$
such that $|\sigma(e)| < |Z_1|$.
\end{definition}

For a graph $G$ and a tree decomposition $(T,\beta)$ that is not lean, a quadruple
$(t_1,t_2,Z_1,Z_2)$ for which the above assertion is not true is called a \emph{lean witness}.
Note that it may happen that $t_1 = t_2$ or $Z_1 \cap Z_2 \neq \emptyset$.
In particular $(s,s,Z_1,Z_2)$ is called a \emph{single bag lean witness}.
The \emph{order} of a lean witness is the minimum order of a separation $(A_1,A_2)$ such that $Z_i \subseteq A_i$ for $i=1,2$.

Bellenbaum and Diestel~\cite{BellenbaumD02} defined an improvement step that, given a tree
decomposition and a lean witness, refines the decomposition so that it is in some sense
closer to being lean.
Given a lean witness $(t_1,t_2,Z_1,Z_2)$, the refinement step finds a minimum order separation $(A_1,A_2)$ with $Z_i \subseteq A_i$ for $i=1,2$ and rearranges the tree decomposition so that $A_1 \cap A_2$ appears
as a new adhesion on some edge of the decomposition.
Bellenbaum and Diestel introduced a potential function, bounded exponentially in $n$, that decreases at every refinement step.
Thus, one can exhaustively apply the refinement step while a lean witness exists, obtaining (after possibly an exponential number of steps) a lean decomposition.

A simple but crucial observation connecting lean decompositions with the decomposition promised by Theorem~\ref{thm:decomposition} is that if a tree decomposition admits no single bag lean witness of order at most $k$,
then every bag is $(i,i)$-unbreakable for every $1 \leq i \leq k$.
By combining this with the fact that the refinement step applied to a lean witness of order $k'$ introduces one new adhesion of size $k'$ (and does not increase the size of other adhesions),
we obtain the following.
\begin{theorem}\label{thm:exist}
For every graph $G$ and integer $k$, there exists a tree decomposition $(T,\beta)$ of $G$ such that every adhesion of $(T,\beta)$ is of size at most $k$
    and every bag is $(i,i)$-unbreakable for every $1 \leq i \leq k$.
\end{theorem}
\begin{proof}[Proof sketch.]
Start with a trivial tree decomposition $(T,\beta)$ that consists of a single bag $V(G)$.
As long as there exists a single bag lean witness of order at most $k$ in $(T,\beta)$, apply the refinement step of Bellenbaum and Diestel to it.
It now remains to observe that if any bag $\beta(t)$ for some $t\in T$ was not $(i,i)$-unbreakable for some $1 \leq i \leq k$,
then the separation witnessing this would give rise to a single bag lean witness for $\beta(t)$.
\end{proof}
A naive implementation of the procedure of Theorem~\ref{thm:exist} runs in time exponential in $n$, while for any application in parameterized algorithms one needs an FPT algorithm with $k$ as the parameter.
To achieve this goal, one needs to overcome two obstacles.

First, the potential provided by Bellenbaum and Diestel gave only an exponential in $n$ bound on the number of needed refinement steps.
Fortunately, one can use the fact that we only refine using single bag witnesses of bounded size to provide a different potential, this time bounded as $2^{\mathcal{O}(k)}n^{\mathcal{O}(1)}$.

Second, one needs to efficiently (in FPT time) verify whether a bag is $(i,i)$-unbreakable for every $1 \leq i \leq k$ and, if not, find a corresponding single bag lean witness.
We design such an algorithm using color-coding: in time $2^{\mathcal{O}(k \log k)} n^{\mathcal{O}(1)}$ we can either
certify that all bags of a given tree decomposition are $(i,i)$-unbreakable for every $1 \leq i \leq k$
or produce a single bag lean witness of order at most $k$.
These ingredients lead to constructing a decomposition with guarantees as in Theorem~\ref{thm:decomposition}.

\medskip

All our applications (Theorems~\ref{thm:bisection},~\ref{thm:steinercut}, and~\ref{thm:multicut}) use the decomposition of Theorem~\ref{thm:decomposition} and follow well-paved ways
of~\cite{randcontr,minbisection-STOC} to perform bottom-up dynamic programming.
Let us briefly sketch this for the case of \textsc{Minimum Bisection}.

Let $(G,k)$ be a \textsc{Minimum Bisection} instance and let $(T,\beta)$ be a tree decomposition of $G$ provided by Theorem~\ref{thm:decomposition}.
The states of our dynamic programming algorithm are the straightforward ones: for every $t \in V(T)$, every $A^\sigma \subseteq \sigma(t)$, and every $0 \leq n^\circ \leq |\alpha(t)|$
we compute value $M[t,A^\sigma,n^\circ]$ equal to the minimum order of an edge cut $(A,B)$ in $G_t$ such that $A \cap \sigma(t) = A^\sigma$ and $|A \setminus \sigma(t)| = n^\circ$.
Furthermore, we are not interested in cut orders larger than $k$, and we replace them with $+\infty$.
Using the unbreakability of $\beta(t)$ we can additionally require that either $A \cap \beta(t)$ or $B \cap \beta(t)$ is of size at most $k$.

In a single step of dynamic programming, one would like to populate $M[t,\cdot,\cdot]$ using the values $M[s,\cdot,\cdot]$ for all children $s$ of $t$ in $T$.
Fix a cell $M[t,A^\sigma,n^\circ]$. Intuitively, one would like to iterate over all partitions $\beta(t) = A^\beta \uplus B^\beta$ with $A^\beta \cap \sigma(t) = A^\sigma$
and, for fixed $(A^\beta,B^\beta)$, for every child $s$ of $t$ use the cells $M[s,\cdot,\cdot]$ to read the best way to extend $(A^\beta \cap \sigma(s), B^\beta \cap \sigma(s))$ to $\alpha(s)$.
However, $\beta(t)$ can be large, so we cannot iterate over all such partitions $(A^\beta,B^\beta)$.
Here, the properties of the decomposition $(T,\beta)$ come into play: since $\beta(t)$ is $(k,k)$-edge-unbreakable, and in the end we are looking for a solution to \textsc{Minimum Bisection} of order at most $k$,
we can only focus on partitions $(A^\beta,B^\beta)$ such that $|A^\beta| \leq k$ or $|B^\beta| \leq k$. While this still does not allow us to iterate over all such partitions, we can highlight important parts of them
by color coding, similarly as it is done in the leaves of the recursion in the randomized contractions framework~\cite{randcontr}.

\section{Applications}\label{s:app}

\input{algo-intro}

\subsection{Minimum Bisection}\label{ss:bisection}
\input{algo-bisection}

\subsection{Steiner Cut and Steiner Multicut}\label{ss:steiner}
\input{algo-steiner}

\input{conclusions}

\section{Preliminaries}\label{s:prelim}

\paragraph*{Color coding toolbox}
Let $[n]=\{1,\ldots,n\}$ for a positive integer $n$.

Many of our proofs follow the same outline as the treatment of the high-connectivity phase of the randomized contractions technique~\cite{randcontr}.
As in~\cite{randcontr}, the color coding step is encapsulated in the following lemma:

\newcommand{\mathcal{F}}{\mathcal{F}}
\begin{lemma}[\cite{randcontr}]\label{lem:random}
Given a set $U$ of size $n$ and integers $0 \leq a,b \leq n$, one
can in time $2^{O(\min(a,b) \log (a+b))} n \log n$
construct a family $\mathcal{F}$ of at most $2^{O(\min(a,b) \log (a+b))} \log n$
subsets of $U$ such that the following holds:
for any sets $A,B \subseteq U$ with $A \cap B = \emptyset$, $|A|\leq a$, and $|B|\leq b$,
there exists a set $S \in \mathcal{F}$ with $A \subseteq S$ and $B \cap S = \emptyset$.
\end{lemma}

We also need the following more general version that can be obtained from Lemma~\ref{lem:random}
by a straightforward induction on $r$.

\begin{lemma}\label{lem:random2}
Given a set $U$ of size $n$ and integers $r \geq 1$, $0 \leq a_1,a_2,\ldots,a_r \leq n$
with $s = \sum_{i=1}^r a_i$, and $c = \max_{i=1}^r a_i$,
one can in time
$2^{\mathcal{O}((s-c) \cdot \log s)} n \log^{r-1} n$
construct a family $\mathcal{F}$ of at most $2^{\mathcal{O}((s-c) \cdot \log s)} \log^{r-1} n$
functions $f \colon U \to \{1,\ldots,r\}$ such that the following holds:
for any pairwise disjoint sets $A_1,A_2,\ldots,A_r \subseteq U$ such that $|A_i|\leq a_i$ for each
$i \in [r]$,
there exists a function $f \in \mathcal{F}$
with $A_i \subseteq f^{-1}(i)$ for every $i \in [r]$.
\end{lemma}

\paragraph*{Tree decompositions: cleanup and compactification}
We will use the following \emph{cleanup procedure} on a tree decomposition $(T,\beta)$ of a graph $G$: as long as there exists
an edge $st \in E(T)$ with $\beta(s) \subseteq \beta(t)$, contract the edge $st$ in $T$, keeping the name $t$ and the bag $\beta(t)$
at the resulting vertex. We shall say that a node $s$ and bag $\beta(s)$ \emph{disappears} in a cleanup step.
Clearly, the final result $(T',\beta')$ of a cleanup procedure is a tree decomposition of $G$ and every adhesion of $(T',\beta')$ is also an adhesion of $(T,\beta)$. Observe that $|E(T')| \leq |V(G)|$: if one roots $T'$ at an arbitrary vertex,
 going from child to parent on every edge $T'$ we forget at least one vertex of $G$, and every vertex can be forgotten only once.

It is well-known that every rooted tree decomposition can be refined to a compact one; see e.g.~\cite[Lemma 2.8]{BojanczykP16}.
For convenience, we provide a formulation of this fact suited for our needs;
a full proof can be found in Appendix~\ref{app:compactification}.

\begin{lemma}\label{lem:compactification}
Given a graph $G$ and its tree decomposition $(T,\beta)$, one can compute in polynomial time a compact tree decomposition $(\wh{T},\wh{\beta})$ of $G$ such that every bag of $(\wh{T},\wh{\beta})$
is a subset of some bag of $(T,\beta)$, and every adhesion of $(\wh{T},\wh{\beta})$ is a subset of some adhesion of $(T,\beta)$.
\end{lemma}