Program Listing for File LinkPredictor.hpp

Return to documentation for file (include/networkit/linkprediction/LinkPredictor.hpp)

/*
 * LinkPredictor.hpp
 *
 *  Created on: 28.02.2015
 *      Author: Kolja Esders
 */

#ifndef NETWORKIT_LINKPREDICTION_LINK_PREDICTOR_HPP_
#define NETWORKIT_LINKPREDICTION_LINK_PREDICTOR_HPP_

#include <memory>

#include <networkit/graph/Graph.hpp>

namespace NetworKit {

class LinkPredictor {
public:
    // Declare typedef in advance for use in the protected section
    using prediction = std::pair<std::pair<node, node>, double>;

private:
    virtual double runImpl(node u, node v) = 0;

protected:
    const Graph *G;

    bool validCache;

public:
    LinkPredictor();

    explicit LinkPredictor(const Graph &G);

    virtual ~LinkPredictor() = default;

    virtual void setGraph(const Graph &newGraph);

    virtual double run(node u, node v);

    virtual std::vector<prediction> runOn(std::vector<std::pair<node, node>> nodePairs);

    virtual std::vector<prediction> runAll();
};

} // namespace NetworKit

#endif // NETWORKIT_LINKPREDICTION_LINK_PREDICTOR_HPP_