Statistical inference in graphs