  A method to compute the full hierarchy of the critical subsets of a density
field is presented. It is based on a watershed technique and uses a probability
propagation scheme to improve the quality of the segmentation by circumventing
the discreteness of the sampling. It can be applied within spaces of arbitrary
dimensions and geometry. This recursive segmentation of space yields, for a
$d$-dimensional space, a $d-1$ succession of $n$-dimensional subspaces that
fully characterize the topology of the density field. The final 1D manifold of
the hierarchy is the fully connected network of the primary critical lines of
the field : the skeleton. It corresponds to the subset of lines linking maxima
to saddle points, and provides a definition of the filaments that compose the
cosmic web as a precise physical object, which makes it possible to compute any
of its properties such as its length, curvature, connectivity etc... When the
skeleton extraction is applied to initial conditions of cosmological N-body
simulations and their present day non linear counterparts, it is shown that the
time evolution of the cosmic web, as traced by the skeleton, is well accounted
for by the Zel'dovich approximation. Comparing this skeleton to the initial
skeleton undergoing the Zel'dovich mapping shows that two effects are competing
during the formation of the cosmic web: a general dilation of the larger
filaments that is captured by a simple deformation of the skeleton of the
initial conditions on the one hand, and the shrinking, fusion and disappearance
of the more numerous smaller filaments on the other hand. Other applications of
the N dimensional skeleton and its peak patch hierarchy are discussed.
