code: def _threepaths(G):
      paths = 0
      for v in G:
          for u in G[v]:
              for w in set(G[u]) - {v}:
                  paths += len(set(G[w]) - {v, u})
      # Divide by two because we count each three path twice
      # one for each possible starting point
      return paths / 2
  
file_path: networkx/networkx/algorithms/bipartite/cluster.py
imports: import itertools
  import networkx
label_desc: Use image node_id 8 for calling a global function with example usage: _threepaths(G) and returns: unknown