class_docstr: Random walking strategy which extracts walks from a root node using the
  Depth First Search (DFS) algorithm if a maximum number of walks is
  specified, otherwise the Breadth First Search (BFS) algorithm is used.
  
  Attributes:
      _is_support_remote: True if the walking strategy can be used with a
          remote Knowledge Graph, False Otherwise
          Defaults to True.
      kg: The global KG used later on for the worker process.
          Defaults to None.
      max_depth: The maximum depth of one walk.
      max_walks: The maximum number of walks per entity.
          Defaults to None.
      md5_bytes: The number of bytes to keep after hashing objects in
          MD5. Hasher allows to reduce the memory occupied by a long
          text. If md5_bytes is None, no hash is applied.
          Defaults to 8.
      random_state: The random state to use to keep random determinism with
          the walking strategy.
          Defaults to None.
      sampler: The sampling strategy.
          Defaults to UniformSampler.
      with_reverse: True to extracts parents and children hops from an
          entity, creating (max_walks * max_walks) walks of 2 * depth,
          allowing also to centralize this entity in the walks. False
          otherwise.
          Defaults to False.
class_docstr_tok: ["Random","walking","strategy","which","extracts","walks","from","a","root","node","using","the","Depth","First","Search","(","DFS",")","algorithm","if","a","maximum","number","of","walks","is","specified",",","otherwise","the","Breadth","First","Search","(","BFS",")","algorithm","is","used",".","Attributes",":","_is_support_remote",":","True","if","the","walking","strategy","can","be","used","with","a","remote","Knowledge","Graph",",","False","Otherwise","Defaults","to","True",".","kg",":","The","global","KG","used","later","on","for","the","worker","process",".","Defaults","to","None",".","max_depth",":","The","maximum","depth","of","one","walk",".","max_walks",":","The","maximum","number","of","walks","per","entity",".","Defaults","to","None",".","md5_bytes",":","The","number","of","bytes","to","keep","after","hashing","objects","in","MD5",".","Hasher","allows","to","reduce","the","memory","occupied","by","a","long","text",".","If","md5_bytes","is","None",",","no","hash","is","applied",".","Defaults","to","8.","random_state",":","The","random","state","to","use","to","keep","random","determinism","with","the","walking","strategy",".","Defaults","to","None",".","sampler",":","The","sampling","strategy",".","Defaults","to","UniformSampler",".","with_reverse",":","True","to","extracts","parents","and","children","hops","from","an","entity",",","creating","(","max_walks","*","max_walks",")","walks","of","2","*","depth",",","allowing","also","to","centralize","this","entity","in","the","walks",".","False","otherwise",".","Defaults","to","False","."]
docstr: Maps certain vertices to MD5 hashes to save memory. For entities of
  interest (provided by the user to the extract function) and predicates,
  the string representation is kept.
  
  Args:
      entity: The entity to be mapped.
      pos: The position of the entity in the walk.
  
  Returns:
      A hash (string) or original string representation.
docstr_tok: ["Maps","certain","vertices","to","MD5","hashes","to","save","memory",".","For","entities","of","interest","(","provided","by","the","user","to","the","extract","function",")","and","predicates",",","the","string","representation","is","kept",".","Args",":","entity",":","The","entity","to","be","mapped",".","pos",":","The","position","of","the","entity","in","the","walk",".","Returns",":","A","hash","(","string",")","or","original","string","representation","."]
code: def _map_vertex(self, entity: Vertex, pos: int) -> str:
      """Maps certain vertices to MD5 hashes to save memory. For entities of
      interest (provided by the user to the extract function) and predicates,
      the string representation is kept.
  
      Args:
          entity: The entity to be mapped.
          pos: The position of the entity in the walk.
  
      Returns:
          A hash (string) or original string representation.
  
      """
      if (
          entity.name in self._entities
          or pos % 2 == 1
          or self.md5_bytes is None
      ):
          return entity.name
      else:
          ent_hash = md5(entity.name.encode()).digest()
          return str(ent_hash[: self.md5_bytes])
  
file_path: pyRDF2Vec/pyrdf2vec/walkers/random.py
imports: from hashlib import md5
  from typing import List, Optional, Set
  import attr
  from pyrdf2vec.graphs import KG, Vertex
  from pyrdf2vec.typings import EntityWalks, SWalk, Walk
  from pyrdf2vec.walkers import Walker
label_desc: Use image node_id 4 for calling the RandomWalker obj's underlying member method code with example usage: obj._map_vertex(entity, pos) and returns: entity, str