We propose a new definition of modularity, i.e. the Qd function, for network analysis, which takes the edge density and topological structure of modules into account and is different from the original strategy of simply calculating the number of edges (the definition of modularity Q introduced by Newman and Girvan). Armed with this novel quality function Qd, we implement an adaptive clustering algorithm for process optimization, and apply our strategy to several synthetic and real-world networks. The results of our exercises demonstrate a better performance in extracting accurate community ingredients from complex networks.