code: def clustering_coefficient_unweighted(user):
      
      matrix = matrix_undirected_unweighted(user)
      closed_triplets = 0
  
      for a, b in combinations(range(len(matrix)), 2):
          a_b, a_c, b_c = matrix[a][b], matrix[a][0], matrix[b][0]
  
          if a_b is None or a_c is None or b_c is None:
              continue
  
          if a_b > 0 and a_c > 0 and b_c > 0:
              closed_triplets += 1.
  
      d_ego = sum(matrix[0])
      return 2 * closed_triplets / (d_ego * (d_ego - 1)) if d_ego > 1 else 0
docs: The clustering coefficient of the user in the unweighted, undirected ego
      network.
  
      It is defined by counting the number of closed triplets including
      the current user:
  
      .. math::
          C = \\frac{2 * \\text{closed triplets}}{ \\text{degree} \, (\\text{degree - 1})}
  
      where ``degree`` is the degree of the current user in the network.