% \algout popis vystupu
% \endalgo
-\def\algo#1{
+\def\algo{
\interlistskip
\begingroup
\let\:=\algoitem
\parskip=1pt plus 1pt minus 0.3pt
\rightskip=2em
\itemcount=0
-{\bo Algoritmus\/} {\sc #1}
}
\def\endalgo{\interlistskip\endgroup}
\def\algopar{\par
\futurelet\next\algoitemh}
\def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
\def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
-\def\algin{\par{\it Vstup:\/} }
-\def\algout{\par{\it Výstup:\/} }
+\def\algin{\par{\sl Input:\/} }
+\def\algout{\par{\sl Output:\/} }
%%% Constructs used in algorithms %%%
\def\problem{\proclaim{Problem}}
\def\obs{\proclaim{Observation}}
\def\rem{\proclaim{Remark}}
+\def\alg{\proclaim{Algorithm}}
\def\label#1{{\sl (#1)\/}\enspace}
+\def\theoremn{\theorem\label}
\def\lemman{\lemma\label}
\def\defnn{\defn\label}
+\def\algn{\alg\label}
\def\proof{\noindent {\sl Proof.}\enspace}
\proclaim{Problem}Given an undirected graph~$G$ with weights $w:E(G)\rightarrow {\bb R}$,
find its minimum spanning tree, where:
-\defn For a given graph~$G$ with weights $w:E(G)\rightarrow {\bb R}$:
+\defn\thmid{mstdef}%
+For a given graph~$G$ with weights $w:E(G)\rightarrow {\bb R}$:
\itemize\ibull
\:A~tree $T$ is a \df{spanning tree} of~$G$ if and only if $V(T)=V(G)$ and $E(T)\subseteq E(G)$.
\:For any subgraph $H\subseteq G$ we define its \df{weight} $w(H):=\sum_{e\in E(H)} w(e)$.
\:A~spanning tree~$T$ is \df{minimal} iff $w(T)$ is the smallest possible of all spanning trees.
+ We use an abbreviation \df{MST} for such trees.
+\:For a disconnected graph, a \df{(minimal) spanning forest (MSF)} is defined as
+ a union of (minimal) spanning trees of its connected components.
\endlist
Bor\accent23uvka's work was further extended by Jarn\'\i{}k \cite{jarnik:ojistem}, again in
Please note that the above properties also apply to tree edges
which by definition cover only themselves and therefore they are always heavy.
-\lemma\thmid{lightlemma}%
+\lemman{Light edges}\thmid{lightlemma}%
Let $T$ be a spanning tree. If there exists a $T$-light edge, then~$T$
is not minimal.
edges.
Conversely, when $T$ is a spanning tree without $T$-light edges
and $T_{min}$ is an arbitrary minimal spanning tree, then according to the Monotone
-exchange lemma~\thmref{monoxchg} there exists a non-decreasing sequence
+exchange lemma (\thmref{monoxchg}) there exists a non-decreasing sequence
of exchanges transforming $T$ to $T_{min}$, so $w(T)\le w(T_{min})$
and thus $T$~is also minimal.
\qed
+In general, a single graph can have many minimal spanning trees (for example
+a complete graph on~$n$ vertices and unit edge weights has $n^{n-2}$
+minimum spanning trees according to the Cayley's formula \cite{cayley:trees}).
+However, this is possible only if the weight function is not injective.
+
+\lemman{MST uniqueness}
+If all edge weights are distinct, then the minimum spanning tree is unique.
+
+\proof
+Consider two minimal spanning trees $T_1$ and~$T_2$. According to the previous
+theorem, there are no light edges with respect to neither of them, so by the
+Monotone exchange lemma (\thmref{monoxchg}) there exists a non-decreasing sequence
+of edge exchanges going from $T_1$ to $T_2$. Each exchange in this sequence is
+strictly increasing, because all edge weights all distinct. On the other hand,
+we know that $w(T_1)=w(T_2)$, so the exchange sequence must be empty and indeed
+$T_1$ and $T_2$ must be identical.
+\qed
+
+\rem\thmid{edgeoracle}%
+To simplify the description of MST algorithms, we will expect that the input
+graph has all edge weights distinct. We will also assume that instead of explicit
+edge weights we will be given a comparison oracle, that is a function which answers
+questions ``$w(e)<w(f)$?'' in constant time. Please note that this is without loss
+of generality, because when some edges have identical weights, we can determine their
+relative order by comparing some unique identifiers of these edges and every MST
+of the new graph will be also a MST of the original one.
+In the few cases where we need a more concrete input, we will explicitly say so.
+
+\section{The Red-Blue Meta-Algorithm}
+
+Most MST algorithms can be described as special cases of the following procedure
+(again following \cite{tarjan:dsna}):
+
+\algn{Red-Blue Meta-Algorithm}
+\algo
+\algin A~graph $G$ with an edge comparison oracle (see \thmref{edgeoracle})
+\:In the beginning, all edges are uncolored.
+\:While possible, use one of the following rules:
+\::Pick a cut~$C$ such that its lightest edge is not blue and color it blue. \cmt{Blue rule}
+\::Pick a cycle~$C$ such that its heaviest edge is not red and color it red. \cmt{Red rule}
+\algout Minimum spanning tree of~$G$ consisting of edges colored blue.
+\endalgo
+
+\rem
+This is not a proper algorithm, since the selection of rules to apply is not specified.
+We will however prove that for any such selection the procedure stops with the correct result.
+Also, it will turn out that each of the classical MST algorithms can be stated as a
+specific rule selection strategy of this procedure, which justifies the name
+meta-algorithm for it.
+
+\lemman{Blue lemma}
+When an edge is colored blue in any step of the procedure, it is contained in the minimum spanning tree.
+
+\proof
+\qed
+
+\lemman{Red lemma}
+When an edge is colored red in any step of the procedure, it is not contained in the minimum spanning tree.
+
+\proof
+\qed
+
+\lemman{Colorless lemma}
+When there exists an uncolored edge, then at least one rule can be applied.
+
+\proof
+\qed
+
+\theoremn{Red-Blue correctness}
+For any selection of rules, the Red-Blue procedure stops and the blue edges form
+the minimum spanning tree of the input graph.
+
+\proof
+\qed
+
+
+
% mention Steiner trees
% mention matroids
% sorted weights