A stochastic block model for community detection in attributed networks