tglite.TSampler

class tglite.TSampler(num_nbrs: int, strategy='recent', num_threads: int = None)
__init__(num_nbrs: int, strategy='recent', num_threads: int = None)

Internal constructor for creating a TSampler

Parameters:
  • num_nbrs (int) – number of neighbors

  • strategy (str) – sampling strategy, ‘recent’ or ‘uniform’

  • num_threads (int) – number of threads for parallel sampling, set to number of cpus if not provided

Raises:

TError – if strategy is not in [‘recent’, ‘uniform’]

sample(blk: TBlock) TBlock

Updates block with sampled 1-hop source neighbors

Returns:

updated block