docs: def hyperedge_cardinality_pairs_list(H):
      """Returns a list of 2-tuples of (\|tail\|, \|head\|) for each hyperedge
      in the hypergraph.
  
      :param H: the hypergraph whose cardinality ratios will be
              operated on.
      :returns: list -- list of 2-tuples for each hyperedge's cardinality.
      :raises: TypeError -- Algorithm only applicable to directed hypergraphs
  
      """
      if not isinstance(H, DirectedHypergraph):
          raise TypeError("Algorithm only applicable to directed hypergraphs")
  
      return [(len(H.get_hyperedge_tail(hyperedge_id)),
              len(H.get_hyperedge_head(hyperedge_id)))
              for hyperedge_id in H.hyperedge_id_iterator()]