An Efficient Algorithm for Community Detection in Complex Weighted Networks