Generalized blockmodeling of sparse networks