gigl.src.common.graph_builder.pyg_graph_data#
Classes#
Extends pytorch geometric graph data objects to provide support for more functionality. |
Module Contents#
- class gigl.src.common.graph_builder.pyg_graph_data.PygGraphData(**kwargs)[source]#
Bases:
torch_geometric.data.hetero_data.HeteroData
,gigl.src.common.graph_builder.gbml_graph_protocol.GbmlGraphDataProtocol
Extends pytorch geometric graph data objects to provide support for more functionality. i.e. providing functionality to do equality checks
- classmethod from_hetero_data(data)[source]#
- Parameters:
data (torch_geometric.data.hetero_data.HeteroData)
- Return type:
- get_global_edge_features_dict()[source]#
Computes and fetches a dictionary mapping the global edge to its relevant edge features
- Returns:
FrozenDict[Edge, torch.Tensor]
- Return type:
gigl.common.collections.frozen_dict.FrozenDict[gigl.src.common.types.graph_data.Edge, torch.Tensor]
- get_global_node_features_dict()[source]#
Computes and fetches a dictionary mapping the global node to its relevant node features
- Returns:
FrozenDict[Node, torch.Tensor]
- Return type:
gigl.common.collections.frozen_dict.FrozenDict[gigl.src.common.types.graph_data.Node, torch.Tensor]
- to_hetero_data()[source]#
Convert the PygGraphData object back to a PyG HeteroData object
- Returns:
The converted HeteroData object
- Return type:
HeteroData
- property edge_types_to_be_registered: List[gigl.src.common.types.graph_data.EdgeType][source]#
Maintains a list of EdgeTypes associated with this graph data.
Used in conjunction with GraphBuilder, to preserve EdgeTypes when combining multiple GbmlGraphDataProtocol objects together.
- Returns:
List[EdgeType]
- Return type:
- property global_node_to_subgraph_node_mapping: gigl.common.collections.frozen_dict.FrozenDict[gigl.src.common.types.graph_data.Node, gigl.src.common.types.graph_data.Node][source]#
Maintains Mapping from original Node to Mapped Node that is used in the underlying graph data format
During creation of GBML Data representations using graph libraries such as DGL and Pytorch geometric, there may be occasions where nodes will need to be remapped to contiguous node ids 0, 1, 2 …. either as a requirement from the graph library or to maintain simpler logic for formulating and working with these graphs data formats.
- Returns:
Dict[Node, Node]
- Return type:
gigl.common.collections.frozen_dict.FrozenDict[gigl.src.common.types.graph_data.Node, gigl.src.common.types.graph_data.Node]
- property subgraph_node_to_global_node_mapping: gigl.common.collections.frozen_dict.FrozenDict[gigl.src.common.types.graph_data.Node, gigl.src.common.types.graph_data.Node][source]#
Inverse mapping of global_node_to_subgraph_node_mapping
- Return type: