LINCellularNeuroscience/VAME

vame.community() fail when transition_matrix is 0 in some pairs.

chenxinfeng4 opened this issue · 0 comments

I set K=30. When I run the code vame.community(config, show_umap=False, cut_tree=2) . It report:

VAME/vame/analysis/tree_hierarchy.py in graph_to_tree(motif_usage, transition_matrix, n_cluster, merge_sel)
    103 #        max_tr = np.max(trans_mat_temp) #merge function
    104 #        nodes = np.where(max_tr == trans_mat_temp)
--> 105         nodes = merge_func(trans_mat_temp, n_cluster, motif_norm_temp, merge_sel)
...
---> 67                     cost = (motif_norm[i] + motif_norm[j]) / np.abs(transition_matrix[i,j] + transition_matrix[j,i] )
     68                 except ZeroDivisionError:

Here is the transition_matrix

array([[0.        , 0.        , 0.        , 0.        , 0.        ,
        0.        , 0.        , 0.        , 0.28571429, 0.02597403,
        0.        , 0.        , 0.        , 0.02597403, 0.        ,
        0.07792208, 0.        , 0.01298701, 0.        , 0.        ,
        0.        , 0.        , 0.01298701, 0.01298701, 0.12987013,
        0.06493506, 0.        , 0.03896104, 0.31168831, 0.        ],
       [0.        , 0.        , 0.        , 0.        , 0.        ,
        0.        , 0.        , 0.        , 0.        , 0.        ,
        0.5       , 0.        , 0.        , 0.        , 0.        ,
        0.        , 0.        , 0.        , 0.        , 0.        ,
        0.        , 0.        , 0.        , 0.        , 0.        ,
        0.        , 0.        , 0.        , 0.5       , 0.        ],
       [0.        , 0.        , 0.        , 0.        , 0.        ,
        0.        , 0.        , 0.19354839, 0.        , 0.        ,
        0.        , 0.        , 0.16129032, 0.        , 0.        ,
        0.48387097, 0.        , 0.        , 0.06451613, 0.        ,
        0.        , 0.        , 0.        , 0.        , 0.        ,
        0.09677419, 0.        , 0.        , 0.        , 0.        ],
.....