Program Listing for File CommonNeighborsIndex.hpp

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

/*
 * CommonNeighborsIndex.hpp
 *
 *  Created on: 06.12.2014
 *      Author: Kolja Esders
 */

#ifndef NETWORKIT_LINKPREDICTION_COMMON_NEIGHBORS_INDEX_HPP_
#define NETWORKIT_LINKPREDICTION_COMMON_NEIGHBORS_INDEX_HPP_

#include <networkit/linkprediction/LinkPredictor.hpp>
#include <networkit/linkprediction/NeighborhoodUtility.hpp>

namespace NetworKit {

class CommonNeighborsIndex final : public LinkPredictor {
    double runImpl(node u, node v) override {
        return NeighborhoodUtility::getCommonNeighbors(*G, u, v).size();
    }

public:
    using LinkPredictor::LinkPredictor;
};

} // namespace NetworKit

#endif // NETWORKIT_LINKPREDICTION_COMMON_NEIGHBORS_INDEX_HPP_