code: def transitivity_bu(A):
      '''
      Transitivity is the ratio of 'triangles to triplets' in the network.
      (A classical version of the clustering coefficient).
  
      Parameters
      ----------
      A : NxN np.ndarray
          binary undirected connection matrix
  
      Returns
      -------
      T : float
          transitivity scalar
      '''
      tri3 = np.trace(np.dot(A, np.dot(A, A)))
      tri2 = np.sum(np.dot(A, A)) - np.trace(np.dot(A, A))
      return tri3 / trif transitivity_bu(A):
      '''
      Transitivity is the ratio of 'triangles to triplets' in the network.
      (A classical version of the clustering coefficient).
  
      Parameters
      ----------
      A : NxN np.ndarray
          binary undirected connection matrix
  
      Returns
      -------
      T : float
          transitivity scalar
      '''
      tri3 = np.trace(np.dot(A, np.dot(A, A)))
      tri2 = np.sum(np.dot(A, A)) - np.trace(np.dot(A, A))
      return tri3 / tri2
docs: Transitivity is the ratio of 'triangles to triplets' in the network.
      (A classical version of the clustering coefficient).
  
      Parameters
      ----------
      A : NxN np.ndarray
          binary undirected connection matrix
  
      Returns
      -------
      T : float
          transitivity scalar