title: How to calculate the jaccard similarity
body: <p>I want to use python to calculate the jaccard similarity for a network. I know the algorithm of the jaccard similarity is the length of the intersection divide the the length of the union. But I could not distinguish between these two ways:</p>
  
  <p>the first way:</p>
  
  <pre><code>import networkx as nx
  A=nx.complete_graph(5)
  B=nx.complete_graph(8)
  jaccard=len(set(A.nodes())&amp;set(B.nodes()))/len(set(A.nodes())|set(B.nodes()))
  </code></pre>
  
  <p>the second way:</p>
  
  <pre><code>import networkx as nx
  A=nx.complete_graph(5)
  B=nx.complete_graph(8)
  jaccard=len(set(A.edges())&amp;set(B.edges()))/len(set(A.edges())|set(B.edges()))
  </code></pre>
  
  <p>Which way could I choose? Thank you!</p>