Program Listing for File JaccardDistance.hpp

Return to documentation for file (include/networkit/distance/JaccardDistance.hpp)

/*
 * JaccardDistance.hpp
 *
 *  Created on: 17.11.2014
 *      Author: Michael Hamann, Gerd Lindner
 */

#ifndef NETWORKIT_DISTANCE_JACCARD_DISTANCE_HPP_
#define NETWORKIT_DISTANCE_JACCARD_DISTANCE_HPP_

#include <networkit/auxiliary/Timer.hpp>
#include <networkit/distance/NodeDistance.hpp>
#include <networkit/graph/Graph.hpp>

namespace NetworKit {

class JaccardDistance final : public NodeDistance {

public:
    JaccardDistance(const Graph &G, const std::vector<count> &triangles);

    void preprocess() override;

    double distance(node u, node v) override;

    const std::vector<double> &getEdgeScores() const override;

private:
    const std::vector<count> &triangles;
    std::vector<double> jDistance; // result vector

    inline double getJaccardDistance(count degU, count degV, count t);
};

} /* namespace NetworKit */
#endif // NETWORKIT_DISTANCE_JACCARD_DISTANCE_HPP_