code: def transitivity_wu(W):
      '''
      Transitivity is the ratio of 'triangles to triplets' in the network.
      (A classical version of the clustering coefficient).
  
      Parameters
      ----------
      W : NxN np.ndarray
          weighted undirected connection matrix
  
      Returns
      -------
      T : int
          transitivity scalar
      '''
      K = np.sum(np.logical_not(W == 0), axis=1)
      ws = cuberoot(W)
      cyc3 = np.diag(np.dot(ws, np.dot(ws, ws)))
      return np.sum(cyc3, axis=0) / np.sum(K * (K - 1), axis=0f transitivity_wu(W):
      '''
      Transitivity is the ratio of 'triangles to triplets' in the network.
      (A classical version of the clustering coefficient).
  
      Parameters
      ----------
      W : NxN np.ndarray
          weighted undirected connection matrix
  
      Returns
      -------
      T : int
          transitivity scalar
      '''
      K = np.sum(np.logical_not(W == 0), axis=1)
      ws = cuberoot(W)
      cyc3 = np.diag(np.dot(ws, np.dot(ws, ws)))
      return np.sum(cyc3, axis=0) / np.sum(K * (K - 1), axis=0)
docs: Transitivity is the ratio of 'triangles to triplets' in the network.
      (A classical version of the clustering coefficient).
  
      Parameters
      ----------
      W : NxN np.ndarray
          weighted undirected connection matrix
  
      Returns
      -------
      T : int
          transitivity scalar