SampledSubgraphImplΒΆ

class dgl.graphbolt.SampledSubgraphImpl(sampled_csc: Optional[Union[dgl.graphbolt.base.CSCFormatBase, Dict[str, dgl.graphbolt.base.CSCFormatBase]]] = None, original_column_node_ids: Optional[Union[torch.Tensor, Dict[str, torch.Tensor]]] = None, original_row_node_ids: Optional[Union[torch.Tensor, Dict[str, torch.Tensor]]] = None, original_edge_ids: Optional[Union[torch.Tensor, Dict[str, torch.Tensor]]] = None)[source]ΒΆ

Bases: dgl.graphbolt.sampled_subgraph.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])}