merge_pyg_graphs_on_anchors

class merge_pyg_graphs_on_anchors(pyg_graphs: List[Data] | Tuple[Data, ...], anchor_links: Tensor)[source]

Bases:

Merge multiple PyG graphs into a single graph based on anchor links.

Parameters:

pyg_graphsList[Data] or Tuple[Data, …]

A list or tuple of PyG Data objects representing the graphs to be merged.

anchor_linkstorch.Tensor

A tensor of shape (num_anchors, num_graphs) containing anchor node indices for each graph.

Returns:

merged_graphData

The merged PyG graph.

merged_anchorstorch.Tensor

A tensor containing the indices of merged anchor nodes in the merged graph.

id2node_dictdict

A dictionary mapping merged node IDs to lists of (graph_id, original_node_id) tuples.

node2id_dictdict

A dictionary mapping (graph_id, original_node_id) tuples to merged node IDs.