  We present a framework to quantify the clustering of gravitational wave (GW)
transient sources and measure their spatial cross-correlation with the
large-scale structure (LSS) of the universe using the $k$-nearest neighbour
($k$NN) formalism. As a first application, we measure the nearest-neighbour
distributions of 53 suitably selected Binary Black Hole (BBH) mergers detected
in the first three observation runs of LIGO-Virgo-KAGRA and cross-correlate
these sources with ~$1.7 \times 10^7$ galaxies and quasars from the
WISE$\times$SuperCOSMOS all-sky catalogue. To determine the significance of the
clustering signal while accounting for observational systematics in the GW
data, we create 135 realisations of mock BBHs that are statistically similar to
the observed BBHs but spatially unclustered. We find no evidence for spatial
clustering or cross-correlation with LSS in the data and conclude that the
present sky localisation and number of detections are insufficient to get a
statistically significant clustering signal. Looking forward, the statistically
large number of detections and the significant improvements in sky
localisations expected from future observing runs of LIGO (including LIGO
India) and the next generation of GW detectors will enable measurement of the
BBH-LSS cross-correlation and open a new window into cosmology.
