Optimizing social group homogeneity in online communities