code: def __init__(
      self,
      graph,
      path_length,
      num_paths,
      dim,
      p=1.0,
      q=1.0,
      dw=False,
      **kwargs,
  ):
      kwargs["workers"] = kwargs.get("workers", 1)
      if dw:
          kwargs["hs"] = 1
          p = 1.0
          q = 1.0
  
      self.graph = graph
      if dw:
          self.walker = walker.BasicWalker(
              graph, workers=kwargs["workers"]
          )
      else:
          self.walker = walker.Walker(
              graph, p=p, q=q, workers=kwargs["workers"]
          )
          print("Preprocess transition probs...")
          self.walker.preprocess_transition_probs()
      sentences = self.walker.simulate_walks(
          num_walks=num_paths, walk_length=path_length
      )
      kwargs["sentences"] = sentences
      kwargs["min_count"] = kwargs.get("min_count", 0)
      kwargs["size"] = kwargs.get("size", dim)
      kwargs["sg"] = 1
  
      self.size = kwargs["size"]
      print("Learning representation...")
      word2vec = Word2Vec(**kwargs)
      self.vectors = {}
      for word in graph.G.nodes():
          self.vectors[word] = word2vec.wv[word]
      del word2vec
  
file_path: OpenNE/src/openne/node2vec.py
imports: from __future__ import print_function
  import time
  from gensim.models import Word2Vec
  from .None import walker
label_desc: Use image node_id 1 to create a new Node2vec object from inherited base classes: object with example: obj = Node2vec(graph, path_length, num_paths, dim, p, q, dw)