komarkdev / der_graph_clustering

Diffusion Entropy Reducer algorithm
2 stars 1 forks source link

Error for DER #1

Closed BradKML closed 3 years ago

BradKML commented 3 years ago
~\.conda\envs\twitter\lib\site-packages\cdlib\algorithms\crisp_partition.py in der(g_original, walk_len, threshold, iter_bound)
    838     graph = convert_graph_formats(_original, nx.raph)
    839 
--> 840     communities, _ = DER.der_graph_clustering(graph, walk_len=walk_len,
    841                                               alg_threshold=threshold, alg_iterbound=iter_bound)
    842 

~\.conda\envs\twitter\lib\site-packages\cdlib\algorithms\internal\DER.py in der_graph_clustering(graph, ncomponents, walk_len, alg_threshold, alg_iterbound, do_soften)
    278     weights = np.array(list(map(lambda i: degs[i], graph.nodes())))
    279 
--> 280     assert sum(weights > 0) == len(weights), 'Zero weights found!'
    281 
    282     data = __create_walks(TM, walk_len)

AssertionError: Zero weights found!
komarkdev commented 3 years ago

Hi, This is a check that the input graph does not have isolated nodes, i.e nodes with degree 0.
Please preprocess the graph and remove isolated nodes before invoking clustering.

Isolated nodes must be (trivial) separate clusters. Because they are rather special, we assume the user decides what to do with them and removes them before the the actual clustering.