(G)
| 984 | return res |
| 985 | |
| 986 | def df(G): |
| 987 | W = nx.zeros(G.shape, type_as=G) |
| 988 | for i in range(G.shape[1]): |
| 989 | for lab in lstlab: |
| 990 | temp = G[labels_a == lab, i] |
| 991 | n = nx.norm(temp) |
| 992 | if n: |
| 993 | W[labels_a == lab, i] = temp / n |
| 994 | return W |
| 995 | |
| 996 | # new vectorized implementation for the cost estimator |
| 997 | labels_u, labels_idx = nx.unique(labels_a, return_inverse=True) |
no test coverage detected