ggfm.data.sample_subgraph

class ggfm.data.sample_subgraph(graph, time_range, sampled_depth=2, sampled_number=8, inp=None)[source]

Bases:

“GPT-GNN: Generative Pre-Training of Graph Neural Networks” paper.

Sample Sub-Graph based on the connection of other nodes with currently sampled nodes Budgets are maintained for each node type, indexed by <node_id, time>. Currently sampled nodes are stored in layer_data. After nodes are sampled, the sampled adjacancy matrix are constructed.

Parameters:
  • graph (class:ggfm.data.Graph) – Target graph.

  • time_range (list) – Time range of target nodes.

  • sampled_depth (int, optional) – Sampled depth. (default: 2)

  • sampled_number (int, optional) – Sampled number. (default: 8)

  • inp (dict) – Input data for sampling. inp = {target_type: samp_target_nodes}