SampledSubgraphImpl

class dgl.graphbolt.SampledSubgraphImpl(sampled_csc: CSCFormatBase | Dict[str, CSCFormatBase] | None = None, original_column_node_ids: Tensor | Dict[str, Tensor] | None = None, original_row_node_ids: Tensor | Dict[str, Tensor] | None = None, original_edge_ids: Tensor | Dict[str, Tensor] | None = None)[source]

Bases: SampledSubgraph

Sampled subgraph of CSCSamplingGraph.

Examples

>>> sampled_csc = {"A:relation:B": CSCFormatBase(indptr=torch.tensor([0, 1, 2, 3]),
... indices=torch.tensor([0, 1, 2]))}
>>> original_column_node_ids = {'B': torch.tensor([10, 11, 12])}
>>> original_row_node_ids = {'A': torch.tensor([13, 14, 15])}
>>> original_edge_ids = {"A:relation:B": torch.tensor([19, 20, 21])}
>>> subgraph = gb.SampledSubgraphImpl(
... sampled_csc=sampled_csc,
... original_column_node_ids=original_column_node_ids,
... original_row_node_ids=original_row_node_ids,
... original_edge_ids=original_edge_ids
... )
>>> print(subgraph.sampled_csc)
{"A:relation:B": CSCForamtBase(indptr=torch.tensor([0, 1, 2, 3]),
... indices=torch.tensor([0, 1, 2]))}
>>> print(subgraph.original_column_node_ids)
{'B': tensor([10, 11, 12])}
>>> print(subgraph.original_row_node_ids)
{'A': tensor([13, 14, 15])}
>>> print(subgraph.original_edge_ids)
{"A:relation:B": tensor([19, 20, 21])}
original_column_node_ids: Dict[str, Tensor] | Tensor = None
original_edge_ids: Dict[str, Tensor] | Tensor = None
original_row_node_ids: Dict[str, Tensor] | Tensor = None
sampled_csc: CSCFormatBase | Dict[str, CSCFormatBase] = None