gigl.types.graph#
Attributes#
Classes#
| Data class containing information about the feature dimension and feature data type for a particular feature | |
| Data and indexing info of a node/edge feature partition. | |
| Data and indexing info of a graph partition. | |
Functions#
| 
 | Check if an edge type is a label edge type. | 
| Convert a label edge type to a message passing edge type. | |
| Convert a message passing edge type to a negative label edge type. | |
| Convert a message passing edge type to a positive label edge type. | |
| 
 | Reverses the source and destination node types of the provided 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.FeatureInfo[source]#
- Data class containing information about the feature dimension and feature data type for a particular feature 
- 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(edge_dir)[source]#
- Convert positive and negative labels to edges. Converts this object in-place to a “heterogeneous” representation. If the edge direction is “in”, we must reverse the supervision edge type. This is because we assume that provided labels are directed outwards in form (anchor_node_type, relation, supervision_node_type), and all edges in the edge index must be in the same direction. - This function requires the following conditions and will throw if they are not met:
- The positive_label is not None 
 
 - Parameters:
- edge_dir (Literal['in', 'out']) – The edge direction of the graph. 
- 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]#
 - node_labels: 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] | None[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_node_labels: 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.is_label_edge_type(edge_type)[source]#
- Check if an edge type is a label edge type. - Parameters:
- edge_type (EdgeType) – The edge type to check. 
- Returns:
- True if the edge type is a label edge type, False otherwise. 
- Return type:
- bool 
 
- gigl.types.graph.label_edge_type_to_message_passing_edge_type(label_edge_type)[source]#
- Convert a label edge type to a message passing edge type. - Parameters:
- label_edge_type (_EdgeType) 
- Return type:
- _EdgeType 
 
- 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.reverse_edge_type(edge_type)[source]#
- Reverses the source and destination node types of the provided edge type :param edge_type: The target edge to have its source and destinated node types reversed :type edge_type: EdgeType - Returns:
- The reversed edge type 
- Return type:
- Parameters:
- edge_type (_EdgeType) 
 
- 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] 
 
