docstr: Initiates the Node2Vec object, precomputes walking probabilities and generates the walks.
  
  :param graph: Input graph
  :param dimensions: Embedding dimensions (default: 128)
  :param walk_length: Number of nodes in each walk (default: 80)
  :param num_walks: Number of walks per node (default: 10)
  :param p: Return hyper parameter (default: 1)
  :param q: Inout parameter (default: 1)
  :param weight_key: On weighted graphs, this is the key for the weight attribute (default: 'weight')
  :param workers: Number of workers for parallel execution (default: 1)
  :param sampling_strategy: Node specific sampling strategies, supports setting node specific 'q', 'p', 'num_walks' and 'walk_length'.
  :param seed: Seed for the random number generator.
  Use these keys exactly. If not set, will use the global ones which were passed on the object initialization
  :param temp_folder: Path to folder with enough space to hold the memory map of self.d_graph (for big graphs); to be passed joblib.Parallel.temp_folder
docstr_tok: ["Initiates","the","Node2Vec","object",",","precomputes","walking","probabilities","and","generates","the","walks",".",":","param","graph",":","Input","graph",":","param","dimensions",":","Embedding","dimensions","(","default",":","128",")",":","param","walk_length",":","Number","of","nodes","in","each","walk","(","default",":","80",")",":","param","num_walks",":","Number","of","walks","per","node","(","default",":","10",")",":","param","p",":","Return","hyper","parameter","(","default",":","1",")",":","param","q",":","Inout","parameter","(","default",":","1",")",":","param","weight_key",":","On","weighted","graphs",",","this","is","the","key","for","the","weight","attribute","(","default",":","'weight","'",")",":","param","workers",":","Number","of","workers","for","parallel","execution","(","default",":","1",")",":","param","sampling_strategy",":","Node","specific","sampling","strategies",",","supports","setting","node","specific","'","q","'",",","'","p","'",",","'num_walks","'","and","'walk_length","'",".",":","param","seed",":","Seed","for","the","random","number","generator",".","Use","these","keys","exactly",".","If","not","set",",","will","use","the","global","ones","which","were","passed","on","the","object","initialization",":","param","temp_folder",":","Path","to","folder","with","enough","space","to","hold","the","memory","map","of","self.d_graph","(","for","big","graphs",")",";","to","be","passed","joblib.Parallel.temp_folder"]
code: def __init__(
      self,
      graph: nx.Graph,
      dimensions: int = 128,
      walk_length: int = 80,
      num_walks: int = 10,
      p: float = 1,
      q: float = 1,
      weight_key: str = "weight",
      workers: int = 1,
      sampling_strategy: dict = None,
      quiet: bool = False,
      temp_folder: str = None,
      seed: int = None,
  ):
      """
      Initiates the Node2Vec object, precomputes walking probabilities and generates the walks.
  
      :param graph: Input graph
      :param dimensions: Embedding dimensions (default: 128)
      :param walk_length: Number of nodes in each walk (default: 80)
      :param num_walks: Number of walks per node (default: 10)
      :param p: Return hyper parameter (default: 1)
      :param q: Inout parameter (default: 1)
      :param weight_key: On weighted graphs, this is the key for the weight attribute (default: 'weight')
      :param workers: Number of workers for parallel execution (default: 1)
      :param sampling_strategy: Node specific sampling strategies, supports setting node specific 'q', 'p', 'num_walks' and 'walk_length'.
      :param seed: Seed for the random number generator.
      Use these keys exactly. If not set, will use the global ones which were passed on the object initialization
      :param temp_folder: Path to folder with enough space to hold the memory map of self.d_graph (for big graphs); to be passed joblib.Parallel.temp_folder
      """
  
      self.graph = graph
      self.dimensions = dimensions
      self.walk_length = walk_length
      self.num_walks = num_walks
      self.p = p
      self.q = q
      self.weight_key = weight_key
      self.workers = workers
      self.quiet = quiet
      self.d_graph = defaultdict(dict)
  
      if sampling_strategy is None:
          self.sampling_strategy = {}
      else:
          self.sampling_strategy = sampling_strategy
  
      self.temp_folder, self.require = None, None
      if temp_folder:
          if not os.path.isdir(temp_folder):
              raise NotADirectoryError(
                  "temp_folder does not exist or is not a directory. ({})".format(
                      temp_folder
                  )
              )
  
          self.temp_folder = temp_folder
          self.require = "sharedmem"
  
      if seed is not None:
          random.seed(seed)
          np.random.seed(seed)
  
      self._precompute_probabilities()
      self.walks = self._generate_walks()
  
file_path: node2vec/node2vec/node2vec.py
imports: import os
  import random
  from collections import defaultdict
  import gensim
  import networkx
  import numpy
  import pkg_resources
  from joblib import Parallel, delayed
  from tqdm.auto import tqdm
  from .parallel import parallel_generate_walks
label_desc: Use image node_id 1 to create a new Node2Vec object  with example: obj = Node2Vec(graph, dimensions, walk_length, num_walks, p, q, weight_key, workers, sampling_strategy, quiet, temp_folder, seed)