2 years ago

#36747

test-img

JustanotherAlien

Fastest way to get minimum Jaccard-Coefficient in networkx

I have a graph in networkx and need to get the edge with the minimum Jaccard-Similarity. I am searching for the most efficient way to do that, because I have to do it multiple times.

I tried to create a dictionary like

J={(jj[0], jj[1]): jj[2] for jj in nx.jaccard_coefficient(G, G.edges())}

min(J, key=J.get)

this is high in time and needs a lot of memory

as well as to just calculate the minimum entry by

min(nx.jaccard_coefficient(G, G.edges()), key=lambda tup: tup[2])

This needs much more time than the previous version. Is there any way to do it more efficient?

python

networkx

minimum

0 Answers

Your Answer

Accepted video resources