gigl.types.graph#
Attributes#
Classes#
Data and indexing info of a node/edge feature partition. |
|
Data and indexing info of a graph partition. |
|
Functions#
Convert a message passing edge type to a negative label edge type. |
|
Convert a message passing edge type to a positive label edge type. |
|
|
Select label edge types for a given message passing edge type. |
Convert a value to a heterogeneous edge representation. |
|
Convert a value to a heterogeneous node representation. |
|
Convert a value to a homogeneous representation. |
Module Contents#
- class gigl.types.graph.FeaturePartitionData[source]#
Data and indexing info of a node/edge feature partition.
- class gigl.types.graph.LoadedGraphTensors[source]#
- treat_labels_as_edges()[source]#
Convert positive and negative labels to edges. Converts this object in-place to a “heterogeneous” representation.
- This function requires the following conditions and will throw if they are not met:
The positive_label is not None
- Return type:
None
- edge_features: torch.Tensor | dict[gigl.src.common.types.graph_data.EdgeType, torch.Tensor] | None[source]#
- edge_index: torch.Tensor | dict[gigl.src.common.types.graph_data.EdgeType, torch.Tensor][source]#
- negative_label: torch.Tensor | dict[gigl.src.common.types.graph_data.EdgeType, torch.Tensor] | None[source]#
- node_features: torch.Tensor | dict[gigl.src.common.types.graph_data.NodeType, torch.Tensor] | None[source]#
- positive_label: torch.Tensor | dict[gigl.src.common.types.graph_data.EdgeType, torch.Tensor] | None[source]#
- class gigl.types.graph.PartitionOutput[source]#
- edge_partition_book: graphlearn_torch.partition.PartitionBook | dict[gigl.src.common.types.graph_data.EdgeType, graphlearn_torch.partition.PartitionBook][source]#
- node_partition_book: graphlearn_torch.partition.PartitionBook | dict[gigl.src.common.types.graph_data.NodeType, graphlearn_torch.partition.PartitionBook][source]#
- partitioned_edge_features: FeaturePartitionData | dict[gigl.src.common.types.graph_data.EdgeType, FeaturePartitionData] | None[source]#
- partitioned_edge_index: GraphPartitionData | dict[gigl.src.common.types.graph_data.EdgeType, GraphPartitionData] | None[source]#
- partitioned_negative_labels: torch.Tensor | dict[gigl.src.common.types.graph_data.EdgeType, torch.Tensor] | None[source]#
- partitioned_node_features: FeaturePartitionData | dict[gigl.src.common.types.graph_data.NodeType, FeaturePartitionData] | None[source]#
- partitioned_positive_labels: torch.Tensor | dict[gigl.src.common.types.graph_data.EdgeType, torch.Tensor] | None[source]#
- gigl.types.graph.message_passing_to_negative_label(message_passing_edge_type)[source]#
Convert a message passing edge type to a negative label edge type.
- gigl.types.graph.message_passing_to_positive_label(message_passing_edge_type)[source]#
Convert a message passing edge type to a positive label edge type.
- gigl.types.graph.select_label_edge_types(message_passing_edge_type, edge_entities)[source]#
Select label edge types for a given message passing edge type.
- Parameters:
- Returns:
A tuple containing the positive label edge type and optionally the negative label edge type.
- Return type:
- gigl.types.graph.to_heterogeneous_edge(x: None) None [source]#
- gigl.types.graph.to_heterogeneous_edge(x: _GraphEntity | dict[gigl.src.common.types.graph_data.EdgeType, _GraphEntity]) dict[gigl.src.common.types.graph_data.EdgeType, _GraphEntity]
Convert a value to a heterogeneous edge representation.
If the input is None, return None. If the input is a dictionary, return it as is. If the input is a single value, return it as a dictionary with the default homogeneous edge type as the key.
- gigl.types.graph.to_heterogeneous_node(x: None) None [source]#
- gigl.types.graph.to_heterogeneous_node(x: _GraphEntity | dict[gigl.src.common.types.graph_data.NodeType, _GraphEntity]) dict[gigl.src.common.types.graph_data.NodeType, _GraphEntity]
Convert a value to a heterogeneous node representation.
If the input is None, return None. If the input is a dictionary, return it as is. If the input is a single value, return it as a dictionary with the default homogeneous node type as the key.
- Parameters:
x (Optional[Union[_GraphEntity, dict[NodeType, _GraphEntity]]]) – The input value to convert.
- Returns:
The converted heterogeneous node representation.
- Return type:
Optional[dict[NodeType, _GraphEntity]]
- gigl.types.graph.to_homogeneous(x: None) None [source]#
- gigl.types.graph.to_homogeneous(x: collections.abc.Mapping[gigl.src.common.types.graph_data.NodeType, _GraphEntity]) _GraphEntity
- gigl.types.graph.to_homogeneous(x: collections.abc.Mapping[gigl.src.common.types.graph_data.EdgeType, _GraphEntity]) _GraphEntity
- gigl.types.graph.to_homogeneous(x: _GraphEntity) _GraphEntity
Convert a value to a homogeneous representation.
If the input is None, return None. If the input is a dictionary, return the single value in the dictionary. If the input is a single value, return it as is.
- Parameters:
x (Optional[Union[_T, dict[Union[NodeType, EdgeType], _T]]]) – The input value to convert.
- Returns:
The converted homogeneous representation.
- Return type:
Optional[_T]