Program Listing for File Node2Vec.hpp

Return to documentation for file (include/networkit/embedding/Node2Vec.hpp)

/*
 *  Node2Vec.hpp
 *
 *
 *  Created on: 29.09.2020
 *      Author: Klaus Ahrens
 *              <ahrens@informatik.hu-berlin.de>
 *
 *  adapted and reimplemented from node2vec
 *  part of snap [https://github.com/snap-stanford/snap]
 *  Copyright (c) 2007-2019, Jure Leskovec (under BSD license)
 *
 *  see [https://arxiv.org/pdf/1607.00653v1.pdf]
 */

#ifndef NETWORKIT_EMBEDDING_NODE2_VEC_HPP_
#define NETWORKIT_EMBEDDING_NODE2_VEC_HPP_

#include <networkit/base/Algorithm.hpp>
#include <networkit/graph/Graph.hpp>

namespace NetworKit {

class Node2Vec final : public Algorithm {

public:
    Node2Vec(const Graph &G, double P = 1, double Q = 1, count L = 80, count N = 10, count D = 128);

    ~Node2Vec() override = default;

    void run() override;

    const std::vector<std::vector<float>> &getFeatures() const;

private:
    // The graph
    const Graph *G;
    // Walk parameter P
    double P;
    // Walk parameter Q
    double Q;
    // Walk length L
    count L;
    // Walk count N
    count N;
    // Feature Dimension D
    count D;

    std::vector<std::vector<float>> features;
};

} /* namespace NetworKit */

#endif // NETWORKIT_EMBEDDING_NODE2_VEC_HPP_