Code to implement the network histogram (Olhede and Wolfe, arXiv:1312.5306)