gigl.src.common.graph_builder.GraphBuilder#
- class gigl.src.common.graph_builder.abstract_graph_builder.GraphBuilder#
Bases:
Generic
[TGraph
]Methods
__init__
Registers a given edge to the TGraph data object that will be built.
Register pre-built graph data to be built into the new Tgraph data object
Registers the given node to the TGraph data object that will be built.
Builds the actual TGraph data object and returns it with all of the registered nodes and edges.
Registers edge types
Unregisters / resets all registered nodes and edges.
- classmethod __init_subclass__(*args, **kwargs)#
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- __weakref__#
list of weak references to the object (if defined)
- add_edge(edge: Edge, feature_values: Tensor | None = None, skip_if_exists: bool = True) GraphBuilder #
Registers a given edge to the TGraph data object that will be built. Both nodes for the edge must be registered before registering the edge
- Args:
edge (Edge) feature_values (Optional[torch.Tensor]): The feature for the edge
- Returns:
GraphBuilder: returns self
- add_graph_data(graph_data: TGraph) GraphBuilder #
Register pre-built graph data to be built into the new Tgraph data object
- Args:
graph_data (TGraph): pre-built TGraph data
- Returns:
GraphBuilder: returns self
- add_node(node: Node, feature_values: Tensor | None = None) GraphBuilder #
Registers the given node to the TGraph data object that will be built.
- Args:
node (Node): [description] feature_values (Optional[torch.Tensor]): [The feature for the node
- Returns:
GraphBuilder: returns self
- abstract build() TGraph #
Builds the actual TGraph data object and returns it with all of the registered nodes and edges. Will also reset i.e. unregister all existed nodes and edges such that GraphBuilder can be used again to build a new graph
- Returns:
TGraph: The data object with all of the nodes/edges
- register_edge_types(edge_types: List[EdgeType]) GraphBuilder #
Registers edge types
- Args:
edge_types (List[EdgeType])
- Returns:
GraphBuilder: returns self
- reset() None #
Unregisters / resets all registered nodes and edges. “Reinitialized the class to a clean state”