Class JaccardDistance

Inheritance Relationships

Base Type

Class Documentation

class JaccardDistance : public NetworKit::NodeDistance

Jaccard distance assigns a distance value to pairs of nodes according to the similarity of their neighborhoods. Note that we define the JaccardDistance as 1-JaccardSimilarity.

Public Functions

JaccardDistance(const Graph &G, const std::vector<count> &triangles)
  • G – The graph.

  • trianglesEdge attribute containing the number of triangles each edge is contained in.

virtual void preprocess() override

REQ: Needs to be called before getEdgeScores delivers meaningful results.

virtual double distance(node u, node v) override

Returns the Jaccard distance between node u and node v.


Jaccard distance between the two nodes.

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

Returns the Jaccard distances between all connected nodes.


Vector containing the Jaccard distances between all connected pairs of nodes.