Then, once this value is calculated for all communities formula_5 is connected to, formula_5 is placed into the community that resulted in the greatest modularity increase. If no increase is possible, formula_5 remains in its original community. This process is applied repeatedly and sequentially to all nodes until no modularity increase can occur. Once this local maximum of modularity is hit, the first phase has ended. In the second phase of the algorithm, it groups all of the nodes in the same community and builds a new network where nodes are the communities from the previous phase. Any links between nodes of the same community are now represented by self-loops on the new community node and links from multiple nodes in the same community to a node in a different community are represented by weighted edges between communities. Once the new network is created, the second phase has ended and the first phase can be re-applied to the new network. When comparing modularity optimization methods, the two measures of importance are the speed and the resulting modularity value. A higher speed is better as it shows a method is more efficient than others and a higher modularity value is desirable as it points to having better-defined communities. The compared methods are, the algorithm of Clauset, Newman, and Moore, Pons and Latapy, and Wakita and Tsurumi. -/- in the table refers to a method that took over 24hrs to run. This table (from ) shows that the Louvain method outperforms many similar modularity optimization methods in both the modularity and the time categories. To deal with directed graphs formula_39, Leicht and Newman  designed the directed modularity.   formula_40  where formula_41 resp. formula_42 are the sum of the weights of the arcs that go to formula_5 resp. comes from formula_6. Dugué and Perez used the Louvain algorithm to optimize the directed modularity formula_45 to emphasize the performance of the algorithm and show the relevance of this modularity version on directed graphs.