Open ImZhou666 opened 2 years ago
Hello, Zhou. It seems that the graph scale is quite large. I don't have your data, and I guess the following code may help,
modu -= (nodex.out_d * self.in_total_degree) / (m**2) + ( nodex.in_d * self.out_total_degree ) / (m**2)
or u may use //
to get an approximate outcome,
or u can use Python's decimal
library to get a float with more capacity.
Hope u will solve it. Feel free to give me some feedbacks and I will appreciate it ! Btw, u may use some more powerful toolkit on the Internet with such a large data : )
When I use the code to divide a graph with 883k edges, I meet the following problem:
Traceback (most recent call last): File "D:\PycharmProjects\Louvain_DirectedGraph\test_louvain.py", line 15, in
res = DG.louvain()
File "D:\PycharmProjects\Louvain_DirectedGraph\algo\Louvain_model.py", line 126, in louvain
self._phase1(max_iter=max_iter)
File "D:\PycharmProjects\Louvain_DirectedGraph\algo\Louvain_model.py", line 156, in _phase1
gain_M[neighbor_commu] = self.community_list[neighbor_commu].cal_delta_modu(self.m, node, self)
File "D:\PycharmProjects\Louvain_DirectedGraph\algo\Louvain_model.py", line 54, in cal_delta_modu
modu -= (nodex.out_d self.in_total_degree + nodex.in_d self.out_total_degree ) / (m**2)
OverflowError: integer division result too large for a float
So do you have any suggestions for dealing with this issue please? Mayby I need operate multiple times?