  As a consequence of galaxy clustering, close galaxies observed on the plane
of the sky should be spatially correlated with a probability that is inversely
proportional to their angular separation. In principle, this information can be
used to improve photometric redshift estimates when spectroscopic redshifts are
available for some of the neighbouring objects. Depending on the depth of the
survey, however, this angular correlation is reduced by chance projections. In
this work, we implement a deep-learning model to distinguish between apparent
and real angular neighbours by solving a classification task. We adopted a
graph neural network architecture to tie together photometry, spectroscopy, and
the spatial information between neighbouring galaxies. We trained and validated
the algorithm on the data of the VIPERS galaxy survey, for which photometric
redshifts based on spectral energy distribution are also available. The model
yields a confidence level for a pair of galaxies to be real angular neighbours,
enabling us to disentangle chance superpositions in a probabilistic way. When
objects for which no physical companion can be identified are excluded, all
photometric redshift quality metrics improve significantly, confirming that
their estimates were of lower quality. For our typical test configuration, the
algorithm identifies a subset containing ~75% high-quality photometric
redshifts, for which the dispersion is reduced by as much as 50% (from 0.08 to
0.04), while the fraction of outliers reduces from 3% to 0.8%. Moreover, we
show that the spectroscopic redshift of the angular neighbour with the highest
detection probability provides an excellent estimate of the redshift of the
target galaxy, comparable to or even better than the corresponding
template-fitting estimate.
