When does the mean network capture the topology of a sample of networks?