  We show how the distances to binary black holes measured in gravitational
wave observations with ground-based interferometers can be used to constrain
the redshift-distance relation and, thereby, measure the Hubble constant
($H_0$). Gravitational wave observations of stellar-mass binary black holes are
not expected to be accompanied by any electro-magnetic event that may help in
accessing their redshifts. We address this deficiency by using an optical
catalog to get the distribution of galaxies in redshift. Assuming that the
clustering of the binaries is correlated with that of the galaxies, we propose
using that correlation to measure $H_0$. We show that employing this method on
simulated data obtained for second-generation networks comprising at least
three detectors, e.g., advanced LIGO - advanced VIRGO network, one can measure
$H_0$ with an accuracy of $\sim$8% with detection of a reference population of
25 binaries, each with black holes of mass 10$M_\odot$. As expected, with
third-generation detectors like the Einstein telescope (ET), which will measure
distances much more accurately and to greater depths, one can obtain better
estimates for $H_0$. Specifically, we show that with 25 observations, ET can
constrain $H_0$ to an accuracy of $\sim$7%. This method can also be used to
estimate other cosmological parameters like the matter density $\Omega_m$ and
the dark energy equation of state.
