update calculation method for modularity