Matrix computation without for loop in python

90 Views Asked by At

I am newcomer with python. Is there a way to remove all 'for loops' and use matrixes and vectors instead?

for trip in u_triplets:
    sub_gr = G.subgraph(trip)
    mot_match = [nx.is_isomorphic(sub_gr, motifs[mot_id]) for mot_id in list(motifs.keys())]
    
    match_keys = [list(motifs.keys())[i] for i in range(len(motifs)) if mot_match[i]]
    
    if len(match_keys) == 1:
        mcount[match_keys[0]] += 1
        
    
0

There are 0 best solutions below