From: Martin Mares Date: Mon, 21 Apr 2008 15:08:52 +0000 (+0200) Subject: Cleaned up contractions. X-Git-Tag: printed~49 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=626b274610e562ca8519b84cb13b207c313a9520;p=saga.git Cleaned up contractions. --- diff --git a/PLAN b/PLAN index 3375880..891c896 100644 --- a/PLAN +++ b/PLAN @@ -82,10 +82,8 @@ Ranking: Notation: -* impedance mismatch in terminology: contraction of G along e vs. contraction of e. - use \delta(X) notation - unify use of n(G) vs. n -* change the notation for contractions -- use double slash instead of the dot? - introduce \widehat\O early Typography: diff --git a/adv.tex b/adv.tex index 299da97..1e9f874 100644 --- a/adv.tex +++ b/adv.tex @@ -181,7 +181,7 @@ $\deg(v)\le 4\varrho$. \:While $n(G)>1$: \::While there exists a~vertex~$v$ such that $\deg(v)\le t$: \:::Select the lightest edge~$e$ incident with~$v$. -\:::Contract~$G$ along~$e$. +\:::Contract~$e$ in~$G$. \:::$T\=T + \ell(e)$. \::Flatten $G$, removing parallel edges and loops. \algout Minimum spanning tree~$T$. @@ -373,7 +373,7 @@ show a~faster integer algorithm soon.) As we already noted, the improved Jarn\'\i{}k's algorithm runs in linear time for sufficiently dense graphs. In some cases, it is useful to combine it with another MST algorithm, which identifies a~part of the MST edges and contracts -the graph to increase its density. For example, we can perform several Bor\o{u}vka +them to increase the density of the graph. For example, we can perform several Bor\o{u}vka steps and find the rest of the MST by the Active Edge Jarn\'\i{}k's algorithm. \algn{Mixed Bor\o{u}vka-Jarn\'\i{}k} @@ -404,7 +404,7 @@ A~good choice of the stopping condition is to place a~limit on the size of the h We start with an~arbitrary vertex, grow the tree as usually and once the heap gets too large, we conserve the current tree and start with a~different vertex and an~empty heap. When this process runs out of vertices, it has identified a~sub-forest of the MST, so we can -contract the graph along the edges of~this forest and iterate. +contract the edges of~this forest and iterate. \algn{Iterated Jarn\'\i{}k; Fredman and Tarjan \cite{ft:fibonacci}}\id{itjar}% \algo @@ -423,7 +423,7 @@ contract the graph along the edges of~this forest and iterate. \:::Denote the resulting tree~$R$. \:::$F\=F\cup R$. \::$T\=T\cup \ell[F]$. \cmt{Remember MST edges found in this phase.} -\::Contract~$G$ along all edges of~$F$ and flatten it. +\::Contract all edges of~$F$ and flatten~$G$. \algout Minimum spanning tree~$T$. \endalgo diff --git a/macros.tex b/macros.tex index c6a617e..4fcc480 100644 --- a/macros.tex +++ b/macros.tex @@ -67,6 +67,7 @@ \def\E{{\bb E}} \def\crpt{\mathbin{\Uparrow}} \def\C{{\cal C}} +\def\sgc{\mathbin{.}} \def\brk{\hfil\break} diff --git a/mst.tex b/mst.tex index 5db0463..0cdab6d 100644 --- a/mst.tex +++ b/mst.tex @@ -544,7 +544,7 @@ We will study dynamic maintenance of connected components in more detail in Chap While the classical algorithms are based on growing suitable trees, they can be also reformulated in terms of edge contraction. Instead of keeping -a forest of trees, we can keep each tree contracted to a single vertex. +a~forest of trees, we can keep each tree contracted to a single vertex. This replaces the relatively complex tree-edge incidencies by simple vertex-edge incidencies, potentially speeding up the calculation at the expense of having to perform the contractions. @@ -584,7 +584,7 @@ lemma applied to a~two-edge cycle, as we will see in \ref{multimst}.) \:While $n(G)>1$: \::For each vertex $v_k$ of~$G$, let $e_k$ be the lightest edge incident to~$v_k$. \::$T\=T\cup \{ \ell(e_k) \}$. \cmt{Remember labels of all selected edges.} -\::Contract $G$ along all edges $e_k$, inheriting labels and weights.\foot{In other words, we ask the comparison oracle for the edge $\ell(e)$ instead of~$e$.} +\::Contract all edges $e_k$, inheriting labels and weights.\foot{In other words, we ask the comparison oracle for the edge $\ell(e)$ instead of~$e$.} \::Flatten $G$, removing parallel edges and loops. \algout Minimum spanning tree~$T$. \endalgo @@ -658,7 +658,7 @@ algorithms as well. The following lemma shows the gist: \lemman{Contraction of MST edges}\id{contlemma}% Let $G$ be a weighted graph, $e$~an arbitrary edge of~$\mst(G)$, $G/e$ the multigraph -produced by contracting $G$ along~$e$, and $\pi$ the bijection between edges of~$G-e$ and +produced by contracting~$e$ in~$G$, and $\pi$ the bijection between edges of~$G-e$ and their counterparts in~$G/e$. Then: $$\mst(G) = \pi^{-1}[\mst(G/e)] + e.$$ \proof diff --git a/notation.tex b/notation.tex index ad256d8..7c12dcd 100644 --- a/notation.tex +++ b/notation.tex @@ -76,7 +76,7 @@ \n{$G[U]$}{subgraph induced by a~set $U\subset V(G)$} \n{$X \choose k$}{the set of all $k$-element subsets of a set~$X$} \n{$G/e$}{multigraph contraction \[contract]} -\n{$G.e$}{simple graph contraction \[simpcont]} +\n{$G\sgc e$}{simple graph contraction \[simpcont]} \n{$G/X$, $G.X$}{contraction by a~set $X$ of vertices or edges \[setcont]} \n{$f[X]$}{function applied to a set: $f[X]:=\{ f(x) \mid x\in X \}$} \n{$f[e]$}{as edges are two-element sets, $f[e]$ maps both endpoints of an edge~$e$} @@ -124,7 +124,8 @@ consider multigraphs with no multiple edges nor loops and simple graphs to be the same objects, although they formally differ. \defn\id{contract}% -Let $G=(V,E,M)$ be a multigraph and $e=xy$ its edge. \df{(Multigraph) contraction of~$G$ along~$e$} +Let $G=(V,E,M)$ be a multigraph and $e=xy$ its arbitrary edge. +The \df{(multigraph) contraction of~$e$ in~$G$} produces a multigraph $G/e=(V',E',M')$ such that: $$\eqalign{ V' &= (V(G) \setminus \{x,y\}) \cup \{v_e\},\quad\hbox{where $v_e$ is a new vertex,}\cr @@ -133,25 +134,26 @@ M'(f) &= \{ m(v) \mid v\in M(f) \} \quad\hbox{for every $f=\in E'$, and}\cr m(x) &= \cases{v_e & \hbox{for $v=x,y,$}\cr v & \hbox{otherwise.}} \cr }$$ -Sometimes we need contraction for simple graphs as well. It corresponds to performing -the multigraph contraction, unifying parallel edges and deleting loops. +Sometimes we need contraction for simple graphs as well. It is equivalent to performing +the multigraph contraction and then unifying parallel edges and deleting loops. \defn\id{simpcont}% -Let $G=(V,E)$ a simple graph and $e=xy$ its edge. \df{(Simple graph) contraction of~$G$ along~$e$} -produces a graph $G.e=(V',E')$ such that: +Let $G=(V,E)$ a simple graph and $e=xy$ its arbitrary edge. +The \df{(simple graph) contraction of~$e$ in~$G$} +produces a graph $G\sgc e=(V',E')$ such that: $$\eqalign{ V' &= (V(G) \setminus \{x,y\}) \cup \{v_e\},\quad\hbox{where $v_e$ is a new vertex,}\cr E' &= \{ \{m(x),m(y)\} \mid xy\in E \land m(x)\ne m(y) \},\cr -m(x) &= \cases{v_e & \hbox{for $v=x,y,$}\cr v & \hbox{otherwise.}} \cr +m(x) &= \cases{v_e & \hbox{for $v=x,y,$}\cr \noalign{\vskip5pt} v & \hbox{otherwise.}} \cr }$$ \defn\id{setcont}% -We can also extend the above definitions to contractions by a~set of vertices or edges. +We can also extend the above definitions to contractions of a~set of vertices or edges. For $F\subseteq E(G)$, the graph $G/F$ is defined as $(G/f_1)/f_2/\ldots/f_k$ where $f_1,\ldots,f_k$ are the elements of~$F$ (you can observe that the result does not depend on the order of edges). For $U\subseteq V(G)$, we define $G/U$ as the graph with all vertices of~$U$ merged to a~single vertex, that is $(G\cup U^*)/U^*$, -where $U^*$ is the complete graph on~$U$. Similarly for $G.F$ and $G.U$. +where $U^*$ is the complete graph on~$U$. Similarly for $G\sgc F$ and $G\sgc U$. %--------------------------------------------------------------------------------