Models and Inference with Network Structure