Stochastic methods for network comparison