gigl.utils.sampling#
Attributes#
Functions#
|
Parses fanout from a string. The fanout string should be equivalent to a str(list[int]) or a |
Module Contents#
- gigl.utils.sampling.parse_fanout(fanout_str)[source]#
Parses fanout from a string. The fanout string should be equivalent to a str(list[int]) or a str(dict[tuple[str, str, str], list[int]]), where each item in the tuple corresponds to the source node type, relation, and destination node type, respectively.
- For example, to parse a list[int], one could provide a fanout_str such as
‘[10, 15, 20]’
- To parse a dict[EdgeType, list[int]], one could provide a fanout_str such as
‘{(“user”, “to”, “user”): [10, 10], (“user”, “to”, “item”): [20, 20]}’
- Parameters:
fanout_str (str) – Provided string to be parsed into fanout
- Returns:
Either a list of fanout per hop of a dictionary of edge types to their respective fanouts per hop
- Return type:
Union[list[int], dict[EdgeType, list[int]]]