  When analyzing temporal networks, a fundamental task is the identification of
dense structures (i.e., groups of vertices that exhibit a large number of
links), together with their temporal span (i.e., the period of time for which
the high density holds). In this paper we tackle this task by introducing a
notion of temporal core decomposition where each core is associated with two
quantities, its coreness, which quantifies how densely it is connected, and its
span, which is a temporal interval: we call such cores \emph{span-cores}.
  For a temporal network defined on a discrete temporal domain $T$, the total
number of time intervals included in $T$ is quadratic in $|T|$, so that the
total number of span-cores is potentially quadratic in $|T|$ as well. Our first
main contribution is an algorithm that, by exploiting containment properties
among span-cores, computes all the span-cores efficiently. Then, we focus on
the problem of finding only the \emph{maximal span-cores}, i.e., span-cores
that are not dominated by any other span-core by both their coreness property
and their span. We devise a very efficient algorithm that exploits theoretical
findings on the maximality condition to directly extract the maximal ones
without computing all span-cores.
  Finally, as a third contribution, we introduce the problem of \emph{temporal
community search}, where a set of query vertices is given as input, and the
goal is to find a set of densely-connected subgraphs containing the query
vertices and covering the whole underlying temporal domain $T$. We derive a
connection between this problem and the problem of finding (maximal)
span-cores. Based on this connection, we show how temporal community search can
be solved in polynomial-time via dynamic programming, and how the maximal
span-cores can be profitably exploited to significantly speed-up the basic
algorithm.
