]> mj.ucw.cz Git - saga.git/commitdiff
First part of fixes to verification.
authorMartin Mares <mj@ucw.cz>
Tue, 11 Mar 2008 10:51:34 +0000 (11:51 +0100)
committerMartin Mares <mj@ucw.cz>
Tue, 11 Mar 2008 10:51:34 +0000 (11:51 +0100)
adv.tex

diff --git a/adv.tex b/adv.tex
index 9c4b1baa519f3c8c4ced962a3d0fd0add9c231d8..f9cec903c48b3885e7a31488ad57ff1d7a659162 100644 (file)
--- a/adv.tex
+++ b/adv.tex
@@ -579,16 +579,16 @@ The queries on~$T$ can be then easily translated to queries on~$B(T)$.
 \defn
 For a~weighted tree~$T$ we define its \df{Bor\o{u}vka tree} $B(T)$ as a~rooted tree which records
 the execution of the Bor\o{u}vka's algorithm run on~$T$. The leaves of $B(T)$
-are exactly the vertices of~$T$, every internal vertex~$v$ at level~$i$ from the bottom
+are all the vertices of~$T$, an~internal vertex~$v$ at level~$i$ from the bottom
 corresponds to a~component tree~$C(v)$ formed in the $i$-th phase of the algorithm. When
-a~tree $C(v)$ selects an adjacent edge~$xy$ and gets merged with some other trees to form
-a~component $C(u)$, we add an~edge $uv$ to~$B(T)$ and set its weight to $w(xy)$.
+a~tree $C(v)$ selects an adjacent edge~$e$ and gets merged with some other trees to form
+a~component $C(u)$, we add an~edge $uv$ to~$B(T)$ and set its weight to $w(e)$.
 
 \figure{bortree.eps}{\epsfxsize}{An octipede and its Bor\o{u}vka tree}
 
 \obs
-As the algorithm finishes with a~single component after the last phase, the Bor\o{u}vka tree
-is really a~tree. All its vertices are on the same level and each internal vertex has
+As the algorithm finishes with a~single component in the last phase, the Bor\o{u}vka tree
+is really a~tree. All its leaves are on the same level and each internal vertex has
 at least two sons. Such trees will be called \df{complete branching trees.}
 
 \lemma
@@ -601,10 +601,10 @@ Let us denote the path $T[x,y]$ by~$P$ and its heaviest edge by~$h=ab$. Similarl
 let us use $P'$ for $B(T)[x,y]$ and $h'$ for the heaviest edge of~$P'$.
 
 We will first prove that~$h$ has its counterpart of the same weight in~$P'$,
-so $w(h') \ge w(h)$. Consider the lowest vertex $u$ of~$T$ such that the
+so $w(h') \ge w(h)$. Consider the lowest vertex $u$ of~$B(T)$ such that the
 component $C(u)$ contains both $a$ and~$b$, and consider the sons $v_a$ and $v_b$ of~$u$
 for which $a\in C(v_a)$ and $b\in C(v_b)$. As the edge~$h$ must have been
-selected by at least one of these components, assume without loss of generality that
+selected by at least one of these components, we assume without loss of generality that
 it was $C(v_a)$, and hence we have $w(uv_a)=w(h)$. We will show that the
 edge~$uv_a$ lies in~$P'$, because exactly one of the endpoints of~$h$ lies
 in~$C(v_a)$. Both endpoints cannot lie there, since it would imply that $C(v_a)$,
@@ -613,13 +613,13 @@ if $C(v_a)$ contained neither~$x$ nor~$y$, it would have to be incident with
 another edge of~$P$ different from~$h$, so this lighter edge would be selected
 instead of~$h$.
 
-For the other direction: for any edge~$uv\in P'$, the tree~$C(v)$ is incident
+In the other direction: for any edge~$uv\in P'$, the tree~$C(v)$ is incident
 with at least one edge of~$P$, so the selected edge must be lighter or equal
-to this edge and hence also than~$h$.
+to this edge and hence also to~$h$.
 \qed
 
 \para
-We will make one more simplification: For an~arbitrary tree~$T$, we split each
+We will simplify the problem even further: For an~arbitrary tree~$T$, we split each
 query path $T[x,y]$ to two half-paths $T[x,a]$ and $T[a,y]$ where~$a$ is the
 \df{lowest common ancestor} of~$x$ and~$y$ in~$T$. It is therefore sufficient to
 consider only paths which connect a~vertex with one of its ancestors.
@@ -627,13 +627,13 @@ consider only paths which connect a~vertex with one of its ancestors.
 When we combine the two transforms, we get:
 
 \lemma\id{verbranch}%
-For each tree~$T$ on $n$~vertices and a~set of $m$~query paths~$Q$ on~$T$, it is possible to find
-a~complete branching tree~$T'$ in $\O(n)$ comparisons, together with a~set~$Q'$ of
-paths on~$T'$, such that the weights of the heaviest edges of the new paths can
-be transformed to the weights of the heaviest edges of the paths in~$Q$ in $\O(m)$ comparisons.
-The tree $T'$ has at most $2n(T)$ vertices and $\O(\log n(T))$ levels. The set~$Q'$ contains
-at most~$2m$ paths and each of them connects a~vertex of~$T'$ with one
-of its ancestors.
+For each tree~$T$ on $n$~vertices and a~set~$Q$ of $q$~query paths on~$T$, it is possible
+to find a~complete branching tree~$T'$, together with a~set~$Q'$ of paths on~$T'$,
+such that the weights of the heaviest edges of the paths in~$Q$ can be deduced from
+the same of the paths in~$Q'$. The tree $T'$ has at most $2n$ vertices and $\O(\log n)$
+levels. The set~$Q'$ contains at most~$2q$ paths and each of them connects a~vertex of~$T'$
+with one of its ancestors. The construction of~$T'$ involves $\O(n)$ comparisons
+and the transformation of the answers takes $\O(q)$ comparisons.
 
 \proof
 The tree~$T'$ will be the Bor\o{u}vka tree for~$T$, obtained by running the
@@ -641,15 +641,14 @@ contractive version of the Bor\o{u}vka's algorithm (Algorithm \ref{contbor})
 on~$T$. The algorithm runs in linear time, for example because trees are planar
 (Theorem \ref{planarbor}). We therefore spend $\O(n)$ comparisons in it.
 
-As~$T'$ has~$m(T)=n(T)-1$ leaves and it is a~complete branching tree, it has at most~$m(T)$ internal vertices,
-so~$n(T')\le 2n(T)$ as promised. Since the number of passes of the Bor\o{u}vka's
-algorithm is $\O(\log n)$, the depth of the tree must be logarithmic as well.
+As~$T'$ has~$n$ leaves and it is a~complete branching tree, it has at most~$n$ internal vertices,
+so~$n(T')\le 2n$ as promised. Since the number of passes of the Bor\o{u}vka's
+algorithm is $\O(\log n)$, the depth of the Bor\o{u}vka tree must be logarithmic as well.
 
 For each query path $T[x,y]$ we find the lowest common ancestor of~$x$ and~$y$
-and replace the path by the two half-paths. This
-produces a~set~$Q'$ of at most~$2m$ half-paths. If we remember the origin
-of each of the new half-paths, the reconstruction of answers to the original queries
-is then just taking the minimum of the answers for the two half-paths.
+and split the path by the two half-paths. This produces a~set~$Q'$ of at most~$2q$ half-paths.
+The heaviest edge of every original query path is then the maximum of the results for
+its halves.
 \qed
 
 \para