]> mj.ucw.cz Git - saga.git/blobdiff - dyn.tex
More of the prolog.
[saga.git] / dyn.tex
diff --git a/dyn.tex b/dyn.tex
index 7797c0b4c7f09bcabb74ea2c90a49fe1d7b2e7c3..f07103ac08cc19f4d596c73cca1c8d1aee0545b5 100644 (file)
--- a/dyn.tex
+++ b/dyn.tex
@@ -68,8 +68,8 @@ therefore also of~$F$), we have to add~$e$ to~$F$. Otherwise, one of the followi
 Either $e$~is $F$-heavy and so the forest~$F$ is also the MSF of the new graph. Or it is $F$-light
 and we have to modify~$F$ by exchanging the heaviest edge~$f$ of the path $F[e]$ with~$e$.
 
-Correctness of the former case follows immediately from the Theorem on Minimality by order
-(\ref{mstthm}), because any $F'$-light would be also $F$-light, which is impossible as $F$~was
+Correctness of the former case follows immediately from the Minimality Theorem (\ref{mstthm}),
+because any $F'$-light would be also $F$-light, which is impossible as $F$~was
 minimum. In the latter case, the edge~$f$ is not contained in~$F'$ because it is the heaviest
 on the cycle $F[e]+e$ (by the Red lemma, \ref{redlemma}). We can now use the Blue lemma
 (\ref{bluelemma}) to prove that it should be replaced with~$e$. Consider the tree~$T$
@@ -225,7 +225,7 @@ $AuvBvuC$ (with no~$u$ nor~$v$ in~$B$) splits to two sequences $AuC$ and $vBv$.
 If there was only a~single occurrence of~$v$, then $v$~was a~leaf and thus the sequence
 transforms from $AuvuC$ to $AuC$ and $v$~alone.
 
-\em{Changing the root} of the tree~$T$ from~$v$ to~$w$ changes the sequence from $vAwBwCv$ to $wBwCvAw$.
+\em{Changing the root} of the tree~$T$ from~$v$ to~$w$ changes its ET-sequence from $vAwBwCv$ to $wBwCvAw$.
 If $w$~was a~leaf, the sequence changes from $vAwCv$ to $wCvAw$. If $vw$ was the only edge of~$T$,
 the sequence $vw$ becomes $wv$. Note that this works regardless of the possible presence of~$w$ inside~$B$.
 
@@ -410,7 +410,7 @@ anyway.)
 }
 
 At the beginning, the graph contains no edges, so both invariants are trivially
-satistifed. Newly inserted edges can enter level~0, which cannot break I1 nor~I2.
+satisfied. Newly inserted edges can enter level~0, which cannot break I1 nor~I2.
 
 When we delete a~tree edge at level~$\ell$, we split a~tree~$T$ of~$F_\ell$ to two
 trees $T_1$ and~$T_2$. Without loss of generality, let us assume that $T_1$ is the
@@ -461,7 +461,7 @@ to attach two lists of edges attached to vertices instead of one, or by using a~
 \::Insert $f$ to~$F_0,\ldots,F_{\ell(f)}$.
 \endalgo
 
-\algn{$\<Replace>(uv,i)$ -- Search for an~replacement edge for~$uv$ at level~$i$}
+\algn{$\<Replace>(uv,i)$ -- Search for replacement for edge~$uv$ at level~$i$}
 \algo
 \algin An~edge~$uv$ to replace and a~level~$i$ such that there is no replacement
 at levels greater than~$i$.
@@ -471,8 +471,9 @@ at levels greater than~$i$.
 \:Enumerate non-tree edges incident with vertices of~$T_1$ and stored in ${\cal E}_i$.
   For each edge~$xy$, $x\in T_1$, do:
 \::If $y\in T_2$, remove~$xy$ from~${\cal E}_i$ and return it to the caller.
-\::Otherwise increase $\ell(xy)$ by one. This includes deleting~$xy$ from~${\cal E}_i$
-  and inserting it to~${\cal E}_{i+1}$.
+\::Otherwise increase $\ell(xy)$ by one.
+  \hfil\break
+  This includes deleting~$xy$ from~${\cal E}_i$ and inserting it to~${\cal E}_{i+1}$.
 \:If $i>0$, call $\<Replace>(xy,i-1)$.
 \:Otherwise return \<null>.
 \algout The replacement edge.
@@ -497,20 +498,31 @@ ET-trees. Additionally, we call \<Replace> up to $L$ times. The initialization o
 \<Replace> costs $\O(\log n)$ per call, the rest is paid for by the edge level
 increases.
 
-To bring the complexity of \<Connected> from $\O(\log n)$ down to $\O(\log n/\log\log n)$,
+To bring the complexity of the operation \<Connected> from $\O(\log n)$ down to $\O(\log n/\log\log n)$,
 we apply the trick from Example \ref{accel} and store~$F_0$ in a~ET-tree with $a=\max(\lfloor\log n\rfloor,2)$.
 This does not hurt the complexity of insertions and deletions, but allows for faster queries.
 \qed
 
+\rem
+An~$\Omega(\log n/\log\log n)$ lower bound for the amortized complexity of the dynamic connectivity
+problem has been proven by Henzinger and Fredman \cite{henzinger:lowerbounds} in the cell
+probe model with $\O(\log n)$-bit words. Thorup has answered by a~faster algorithm
+\cite{thorup:nearopt} that achieves $\O(\log n\log^3\log n)$ time per update and
+$\O(\log n/\log^{(3)} n)$ per query on a~RAM with $\O(\log n)$-bit words. (He claims
+that the algorithm runs on a~Pointer Machine, but it uses arithmetic operations,
+so it does not fit the definition of the PM we use. The algorithm only does not
+need direct indexing of arrays.) So far, it is not known how to extend this algorithm
+to fit our needs, so we omit the details.
+
 %--------------------------------------------------------------------------------
 
-\section{Dynamic MSF}
+\section{Dynamic spanning forests}\id{dynmstsect}%
 
 Let us turn our attention back to the dynamic MSF now.
 Most of the early algorithms for dynamic connectivity also imply $\O(n^\varepsilon)$
 algorithms for dynamic maintenance of the MSF. Henzinger and King \cite{henzinger:twoec,henzinger:randdyn}
 have generalized their randomized connectivity algorithm to maintain the MSF in $\O(\log^5 n)$ time per
-operation, or $\O(k\log^3 n)$ if only~$k$ different values of edge weights are allowed. They have solved
+operation, or $\O(k\log^3 n)$ if only $k$ different values of edge weights are allowed. They have solved
 the decremental version of the problem first (which starts with a~given graph and only edge deletions
 are allowed) and then presented a~general reduction from the fully dynamic MSF to its decremental version.
 We will describe the algorithm of Holm, de Lichtenberg and Thorup \cite{holm:polylog}, who have followed
@@ -544,7 +556,7 @@ edges for~$e$, the lightest one is at the maximum level.
 
 \proof
 Let us consider any two edges $f_1$ and~$f_2$ replacing~$e$. By minimality of~$F$ and the Cycle
-rule (\ref{cyclerule}), each $f_i$ is the heaviest edge on the cycle~$C_i = F[f_i] + f_i$.
+rule (Lemma \ref{redlemma}), each $f_i$ is the heaviest edge on the cycle~$C_i = F[f_i] + f_i$.
 In a~moment, we will show that the symmetric difference~$C$ of these two cycles is again a~cycle.
 This implies that if $f_1$ is heavier than~$f_2$, then $f_1$~is the heaviest edge on~$C$, so
 $\ell(f_1) \le \ell(f_2)$ by I3. Therefore the lightest of all replacement edges must have
@@ -568,23 +580,27 @@ When the structure is freshly initialized, I3 is obviously satisfied, as all edg
 are at level~0. Sole deletions of edges (both tree and non-tree) cannot violate I3, so we need
 to check only the replaces, in particular the place when an~edge~$e$ gets its level increased.
 
-For the violation to happen, $e$~must be the heaviest on some cycle~$C$, so by the Cycle
-rule, $e$~must be non-tree. The increase of $\ell(e)$ must therefore take place when~$e$ is
-considered as a~replacement edge incident with some tree~$T_1$ at level $\ell=\ell(e)$.
-We will pause the computation just before this increase and we will prove that
-all other edges of~$C$ already are at levels greater than~$\ell$.
+For the violation to happen for the first time, $e$~must be the heaviest on
+some cycle~$C$, so by the Cycle rule, $e$~must be non-tree. The increase of
+$\ell(e)$ must therefore take place when~$e$ is considered as a~replacement
+edge incident with some tree~$T_1$ at level $\ell=\ell(e)$. We will pause the
+computation just before this increase and we will prove that all other edges
+of~$C$ already are at levels greater than~$\ell$, so the violation cannot occur.
 
-Let us first show that for edges of~$C$ incident with~$T_1$. All edges of~$T_1$ itself
+Let us first show this for edges of~$C$ incident with~$T_1$. All edges of~$T_1$ itself
 already are at the higher levels as they were moved there at the very beginning of the
-search for the replacement edge. As the algorithm always picks the lightest candidate
-for the replacement edge available, all non-tree edges incident with~$T_1$ that are lighter
-than~$e$ were already considered and thus also moved one level up. This includes all
-other edges of~$C$ that are incident with~$T_1$.
+search for the replacement edge. The other tree edges incident with~$T_1$ would have
+lower levels, which is impossible since the invariant would be already violated.
+Non-tree edges of~$C$ incident with~$T_1$ are lighter than~$e$, so they were already considered
+as~candidates for the replacement edge, because the algorithm always picks the lightest
+candidate first. Such edges therefore have been already moved a~level up.
 
 The case of edges of~$C$ that do not touch~$T_1$ is easy to handle: Such edges do not exist.
-If they did, at least two edges of~$C$ would have to be non-tree edges connecting~$T_1$
-with the other trees at level~$\ell$, so one of them that is lighter than~$e$ would be selected as the
-replacement edge before~$e$ could be considered.
+If they did, at least one more edge of~$C$ besides~$e$ would have to connect~$T_1$ with the other
+trees of level~$\ell$. We already know that this could not be a~tree edge. If it were a~non-tree
+edge, it could not have level greater than~$\ell$ by~I1 nor smaller than~$\ell$ by~I3. Therefore
+it would be a~level~$\ell$ edge lighter than~$e$, and as such it would have been selected as the
+replacement edge before $e$~was.
 \qed
 
 We can conclude:
@@ -592,13 +608,13 @@ We can conclude:
 \thmn{Decremental MSF, Holm et al.~\cite{holm:polylog}}
 When we start with a~graph on $n$~vertices with~$m$ edges and we perform a~sequence of
 edge deletions, the MSF can be initialized in time $\O((m+n)\cdot\log^2 n)$ and then
-updated in time $\O(log^2 n)$ amortized per operation.
+updated in time $\O(\log^2 n)$ amortized per operation.
 
 \paran{Fully dynamic MSF}%
 The decremental MSF algorithm can be turned to a~fully dynamic one by a~blackbox
 reduction whose properties are summarized in the following theorem:
 
-\thmn{MSF dynamization, Henzinger et al.~\cite{henzinger:twoec}, Holm et al.~\cite{holm:polylog}}
+\thmn{MSF dynamization, Holm et al.~\cite{holm:polylog}}
 Suppose that we have a~decremental MSF algorithm with the following properties:
 \numlist\ndotted
 \:For any $a$,~$b$, it can be initialized on a~graph with~$a$ vertices and~$b$ edges.
@@ -621,7 +637,7 @@ Delete of a~non-tree edge is performed on all $A_i$'s containing it and the repl
 sought among the replacement edges found in these structures. The unused replacement edges then have
 to be reinserted back to the structure.
 
-The original reduction of Henzinger et al.~handles these reinserts by a~mechanism of batch insertions
+The original reduction of Henzinger et al.~\cite{henzinger:twoec} handles these reinserts by a~mechanism of batch insertions
 supported by their decremental structure, which is not available in our case. Holm et al.~have
 replaced it by a~system of auxiliary edges inserted at various places in the structure.
 We refer to the article \cite{holm:polylog} for details.
@@ -645,18 +661,13 @@ The limitation of MSF structures based on the Holm's algorithm for connectivity
 to only edge deletions seems to be unavoidable. The invariant I3 could be easily
 broken for many cycles at once whenever a~very light non-tree edge is inserted.
 We could try increasing the level of the newly inserted edge, but we would quite
-possibly hit I1 before we skipped the levels of all the heaviest edges on the
+likely hit I1 before we managed to skip the levels of all the heaviest edges on the
 particular cycles.
 
-On the other hand, if we decided to drop I3, we would encounter different problems.
-We have enough time to scan all non-tree edges incident to the current tree~$T_1$
---- we can charge it on the level increases of its tree edges and if we use the
-degree reduction from Lemma \ref{degred}, there are at most two non-tree edges
-per vertex. (The reduction can be used dynamically as it always translates a~single
-change of the original graph to $\O(1)$ changes of the reduced graph.) The lightest
-replacement edge however could also be located in the super-trees of~$T_1$ at the
-lower levels, which are too large to scan and both I1 and I2 prevent us from
-charging the time on increasing levels there.
+On the other hand, if we decided to drop I3, we would encounter different problems. The ET-trees can
+bring the lightest non-tree incident with the current tree~$T_1$, but the lightest replacement edge
+could also be located in the super-trees of~$T_1$ at the lower levels, which are too large to scan
+and both I1 and I2 prevent us from charging the time on increasing levels there.
 
 An~interesting special case in which insertions are possible is when all non-tree
 edges have the same weight. This leads to the following algorithm for dynamic MSF
@@ -666,8 +677,9 @@ but adapted to use the better results on dynamic connectivity we have at hand.
 
 \paran{Dynamic MSF with limited edge weights}%
 Let us assume for a~while that our graph has edges of only two different weights (let us say
-1~and~2). We will forget our rule that all edge weights are distinct for a~moment and we recall that
-the basic structural properties of the MST's from Section \ref{mstbasics} still hold.
+1~and~2). We will forget our rule that all edge weights are distinct for a~moment and we recall
+the observation in \ref{multiweight} that the basic structural properties of
+the MST's from Section \ref{mstbasics} still hold.
 
 We split the graph~$G$ to two subgraphs~$G_1$ and~$G_2$ according to the edge
 weights. We use one instance~$\C_1$ of the dynamic connectivity algorithm maintaining