def _extract(self, kg: KG, entity: Vertex) -> EntityWalks:
    'Extracts random walks for an entity based on a Knowledge Graph.\n\n        Args:\n            kg: The Knowledge Graph.\n            entity: The root node to extract walks.\n\n        Returns:\n            A dictionary having the entity as key and a list of tuples as value\n            corresponding to the extracted walks.\n\n        '
    canonical_walks: Set[SWalk] = set()
    for n in range((self.wl_iterations + 1)):
        for walk in self.extract_walks(kg, entity):
            canonical_walk: List[str] = [self._map_wl(vertex, i, n) for (i, vertex) in enumerate(walk)]
            canonical_walks.add(tuple(canonical_walk))
    return {entity.name: list(canonical_walks)}
Extracts random walks for an entity based on a Knowledge Graph.

Args:
    kg: The Knowledge Graph.
    entity: The root node to extract walks.

Returns:
    A dictionary having the entity as key and a list of tuples as value
    corresponding to the extracted walks.
def _extract(self, kg: KG, entity: Vertex) -> EntityWalks:
    'Extracts random walks for an entity based on a Knowledge Graph.\n\n        Args:\n            kg: The Knowledge Graph.\n            entity: The root node to extract walks.\n\n        Returns:\n            A dictionary having the entity as key and a list of tuples as value\n            corresponding to the extracted walks.\n\n        '
    canonical_walks: Set[SWalk] = set()
    for n in range((self.wl_iterations + 1)):
        for walk in self.extract_walks(kg, entity):
            canonical_walk: List[str] = [self._map_wl(vertex, i, n) for (i, vertex) in enumerate(walk)]
            canonical_walks.add(tuple(canonical_walk))
    return {entity.name: list(canonical_walks)}