code: def _get_cover_deterministic(
      triples: MappedTriples,
  ) -> torch.BoolTensor:
      """
      Get a coverage mask for all entities and relations.
  
      The implementation uses a greedy coverage algorithm for selecting triples. If there are multiple triples to
      choose, the smaller ID is preferred.
  
      1. Select one triple for each relation.
      2. Select one triple for each head entity, which is not yet covered.
      3. Select one triple for each tail entity, which is not yet covered.
  
      The cover is guaranteed to contain at most $num_relations + num_unique_heads + num_unique_tails$ triples.
  
      :param triples: shape: (n, 3)
          The triples (ID-based).
  
      :return: shape: (n,)
          A boolean mask indicating whether the triple is part of the cover.
      """
      df = pandas.DataFrame(
          data=triples.numpy(), columns=COLUMN_LABELS
      ).reset_index()
  
      # select one triple per relation
      chosen = _get_cover_for_column(df=df, column=LABEL_RELATION)
  
      # maintain set of covered entities
      covered = _get_covered_entities(df=df, chosen=chosen)
  
      # Select one triple for each head/tail entity, which is not yet covered.
      for column in (LABEL_HEAD, LABEL_TAIL):
          covered = _get_covered_entities(df=df, chosen=chosen)
          chosen |= _get_cover_for_column(
              df=df[~df[column].isin(covered)], column=column
          )
  
      # create mask
      num_triples = triples.shape[0]
      seed_mask = torch.zeros(num_triples, dtype=torch.bool)
      seed_mask[list(chosen)] = True
      return seed_mask
  
imports: import logging
  import typing
  from abc import abstractmethod
  from typing import Collection, Optional, Sequence, Set, Tuple, Type, Union
  import numpy
  import pandas
  import torch
  from class_resolver.api import ClassResolver, HintOrType
  from ..constants import COLUMN_LABELS
  from ..typing import LABEL_HEAD, LABEL_RELATION, LABEL_TAIL, MappedTriples, Target, TorchRandomHint
  from ..utils import ensure_torch_random_state
label_desc: Use image node_id 4 for calling a global function with example usage: _get_cover_deterministic(triples) and returns: seed_mask