Bases: Algorithm
Algorithm to extract features from the graph with the node2vec(word2vec) algorithm according to [https://arxiv.org/pdf/1607.00653v1.pdf].
Node2Vec learns embeddings for nodes in a graph by optimizing a neighborhood preserving objective. In order to achieve this, biased random walks are initiated for every node and the result is of probabilistic nature. Several input parameters control the specific behavior of the random walks. Amongst others Node2Vec is able to produce embeddings for visualization (D=2 or D=3) and machine learning (D=128 [default]). Both directed and undirected graphs withouth isolated nodes are supported.
Note
This algorithm could take a lot of time on large networks (many nodes).
G (networkit.Graph) – The graph.
P (float) – The ratio for returning to the previous node on a walk. For P > max(Q,1) it is less likely to sample an already-visited node in the following two steps. For P < min(Q,1) it is more likely to sample an already-visited node in the following two steps.
Q (float) – The ratio for the direction of the next step For Q > 1 the random walk is biased towards nodes close to the previous one. For Q < 1 the random walk is biased towards nodes which are further away from the previous one.
L (int) – The walk length.
N (int) – The number of walks per node.
D (int) – The dimension of the calculated embedding.
Returns all feature vectors
A vector containing feature vectors of all nodes
list(list(float))