Program Listing for File DynamicNMIDistance.hpp

Return to documentation for file (include/networkit/community/DynamicNMIDistance.hpp)

/*
 * DynamicNMIDistance.hpp
 *
 *  Created on: Jun 26, 2013
 *      Author: Henning
 */

#ifndef NETWORKIT_COMMUNITY_DYNAMIC_NMI_DISTANCE_HPP_
#define NETWORKIT_COMMUNITY_DYNAMIC_NMI_DISTANCE_HPP_

#include <networkit/community/DissimilarityMeasure.hpp>
#include <networkit/community/NMIDistance.hpp>

namespace NetworKit {

using Matrix = std::vector<std::vector<count>>;

class DynamicNMIDistance final : public DissimilarityMeasure {
public:
    double getDissimilarity(const Graph &newGraph, const Partition &oldClustering,
                            const Partition &newClustering) override;

    void combineValues(double H_sum, double MI, double &NMI, double &NMID) const;
    void sanityCheck(double &NMI, double &NMID) const;

    double entropy(const Partition &clustering, count n, std::vector<double> probs);

    bool isInBoth(node u, const Partition &oldClustering, const Partition &newClustering);

    Matrix confusionMatrix(const Graph &G, const Partition &zeta, const Partition &eta);
};

} /* namespace NetworKit */
#endif // NETWORKIT_COMMUNITY_DYNAMIC_NMI_DISTANCE_HPP_