gigl.src.common.graph_builder.GbmlGraphDataProtocol#
- class gigl.src.common.graph_builder.gbml_graph_protocol.GbmlGraphDataProtocol(*args, **kwargs)#
Bases:
Protocol
Methods
Returns True if the two GbmlGraphDataProtocol objects do not share any edges.
Args:
Computes and fetches a dictionary mapping the global edge to its relevant edge features
Computes and fetches a dictionary mapping the global node to its relevant node features
- __init__(*args, **kwargs)#
- 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.
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- __weakref__#
list of weak references to the object (if defined)
- static are_disjoint(a: GbmlGraphDataProtocol, b: GbmlGraphDataProtocol) bool #
Returns True if the two GbmlGraphDataProtocol objects do not share any edges. :param a: :param b: :return:
- static are_same_graph(a: GbmlGraphDataProtocol, b: GbmlGraphDataProtocol) bool #
- Args:
a (GbmlGraphDataProtocol) b (GbmlGraphDataProtocol)
- Returns:
bool: Returns True if both a and b objects that implement GbmlGraphDataProtocol represent the same graph in the global space. i.e. both have same nodes + related features, and edges + related features. i.e. a form of loose equality.
For example for a: PygGraphData and b: PygGraphData, may both have same 3 nodes and 3 edges with the same features. But, because they are built in a specific way i.e order of edges and nodes, they may not be strictly equal: a != b. But really, the two represent the same “graph” in different ways. This function fills that gap.
- property edge_types_to_be_registered: List[EdgeType]#
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]
- get_global_edge_features_dict() FrozenDict[Edge, Tensor] #
Computes and fetches a dictionary mapping the global edge to its relevant edge features
- Returns:
FrozenDict[Edge, torch.Tensor]
- get_global_node_features_dict() FrozenDict[Node, Tensor] #
Computes and fetches a dictionary mapping the global node to its relevant node features
- Returns:
FrozenDict[Node, torch.Tensor]
- property global_node_to_subgraph_node_mapping: FrozenDict[Node, Node]#
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]
- property subgraph_node_to_global_node_mapping: FrozenDict[Node, Node]#
Inverse mapping of global_node_to_subgraph_node_mapping
- Returns:
FrozenDict[Node, Node]: