zzz24512653 / CommunityDetection

Implements of community detection algorithms
354 stars 174 forks source link

fix "ValueError: max()" in LPA.get_max_neighbor_label() #10

Open javeme opened 5 years ago

javeme commented 5 years ago

max(m.itervalues()) will raise ValueError when calling LPA.get_max_neighbor_label() with a parameter isolated vertex, which has no neighbors. It is reasonable to return label of the vertex itself if it's an isolated vertex.

pass empty sequence parameter to max():

>>> m=dict()
>>> max(m.itervalues())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: max() arg is an empty sequence

fix #9