class AddRandomMetaPaths(metapaths: List[List[Tuple[str, str, str]]], drop_orig_edge_types: bool = False, keep_same_node_type: bool = False, drop_unconnected_node_types: bool = False, walks_per_node: Union[int, List[int]] = 1, sample_ratio: float = 1.0)[source]

Bases: BaseTransform

Adds additional edge types similar to AddMetaPaths. The key difference is that the added edge type is given by multiple random walks along the metapath. One might want to increase the number of random walks via walks_per_node to achieve competitive performance with AddMetaPaths.

  • metapaths (List[List[Tuple[str, str, str]]]) – The metapaths described by a list of lists of (src_node_type, rel_type, dst_node_type) tuples.

  • drop_orig_edge_types (bool, optional) – If set to True, existing edge types will be dropped. (default: False)

  • keep_same_node_type (bool, optional) – If set to True, existing edge types between the same node type are not dropped even in case drop_orig_edge_types is set to True. (default: False)

  • drop_unconnected_node_types (bool, optional) – If set to True, will drop node types not connected by any edge type. (default: False)

  • walks_per_node (int, List[int], optional) – The number of random walks for each starting node in a metapth. (default: 1)

  • sample_ratio (float, optional) – The ratio of source nodes to start random walks from. (default: 1.0)