import networkx as nx
from node2vec import Node2Vec

# FILES
EMBEDDING_FILENAME = './embeddings.emb'
EMBEDDING_MODEL_FILENAME = './embeddings.model'

# Create a graph
graph = nx.fast_gnp_random_graph(n=100, p=0.5)

# Precompute probabilities and generate walks
node2vec = Node2Vec(graph, dimensions=64, walk_length=30, num_walks=200, workers=4)
## if d_graph is big enough to fit in the memory, pass tmp_dir which has enough disk space
node2vec = Node2Vec(graph, dimensions=64, walk_length=30, num_walks=200, workers=4, tmp_dir="/mnt/tmp_data")

# Embed
model = node2vec.fit(window=10, min_count=1, batch_words=4)  # Any keywords acceptable by gensim.Word2Vec can be passed, `diemnsions` and `workers` are automatically passed (from the Node2Vec constructor)

# Look for most similar nodes
model.wv.most_similar('2')  # Output node names are always strings

# Save embeddings for later use
model.wv.save_word2vec_format(EMBEDDING_FILENAME)

# Save model for later use
model.save(EMBEDDING_MODEL_FILENAME)

@@ -338,16 +338,17 @@
 kers=4)%0A
+%0A
 ## if d_
@@ -395,21 +395,25 @@
 , pass t
+e
 mp_
-di
+folde
 r which 
@@ -434,16 +434,103 @@
 k space%0A
+# Note: It will trigger %22sharedmem%22 in Parallel, which will be slow on smaller graphs%0A#
 node2vec
@@ -610,13 +610,17 @@
 4, t
+e
 mp_
-di
+folde
 r=%22/

add relevant example