  For $G$ an algebraic group definable over a model of $\operatorname{ACVF}$,
or more generally a definable subgroup of an algebraic group, we study the
stable completion $\widehat{G}$ of $G$, as introduced by Loeser and the second
author. For $G$ connected and stably dominated, assuming $G$ commutative or
that the valued field is of equicharacteristic 0, we construct a pro-definable
$G$-equivariant strong deformation retraction of $\widehat{G}$ onto the generic
type of $G$.
  For $G=S$ a semiabelian variety, we construct a pro-definable $S$-equivariant
strong deformation retraction of $\widehat{S}$ onto a definable group which is
internal to the value group. We show that, in case $S$ is defined over a
complete valued field $K$ with value group a subgroup of $\mathbb{R}$, this map
descends to an $S(K)$-equivariant strong deformation retraction of the
Berkovich analytification $S^{\mathrm{an}}$ of $S$ onto a piecewise linear
group, namely onto the skeleton of $S^{\mathrm{an}}$. This yields a
construction of such a retraction without resorting to an analytic
(non-algebraic) uniformization of $S$.
  Furthermore, we prove a general result on abelian groups definable in an NIP
theory: any such group $G$ is a directed union of $\infty$-definable subgroups
which all stabilize a generically stable Keisler measure on $G$.

Logic;Algebraic Geometry