docs: def _F_hyperedge_cardinality_ratio(H, F):
      """Returns the result of a function F applied to the set of cardinality
      ratios between the tail and the head sets (specifically, |tail|/|head|) of
      hyperedges in the hypergraph.
  
      :param H: the hypergraph whose cardinality ratios will be
                      operated on.
      :param F: function to execute on the set of cardinality ratios in the
              hypergraph.
      :returns: result of the given function F.
      :raises: TypeError -- Algorithm only applicable to directed hypergraphs
  
      """
      if not isinstance(H, DirectedHypergraph):
          raise TypeError("Algorithm only applicable to directed hypergraphs")
  
      # Since |head| can potentially be 0 (causing a division by 0 exception),
      # we use numpy's float64 to have division by 0 result in inf, which is
      # then cast back to a float for our final result
      return F([float(tail_card / np.float64(head_card))
               for tail_card, head_card in hyperedge_cardinality_pairs_list(H)])