In network analysis, it is common that within community is more likely connected than between community, which is reflected by the edges within a community are more correlated. However, the traditional probabilistic models for community detection like stochastic block model (SBM) are not able to capture the dependence among edges. The revised SBM based on random effects can only handle exchangeable dependence structure on whole networks. In this talk, we propose a new community detection approach based on the Bahadur representation to utilize the within-community dependence of connectivity. The proposed method allows for the heterogeneity among edges and provides greater flexibility in handling different types of within-community dependence structure. In addition, the proposed algorithm does not involve specifying the likelihood function that could be intractable when correlations exist among edges. We demonstrate the application of the proposed method to the agricultural product trading networks. This is joint work with Yubai Yuan.