Program Listing for File GroupHarmonicCloseness.hpp

Return to documentation for file (include/networkit/centrality/GroupHarmonicCloseness.hpp)

/*
 * GroupHarmonicCloseness.hpp
 *
 * Created on: 15.12.2020
 *     Author: Eugenio Angriman <angrimae@hu-berlin.de>
 */

#ifndef NETWORKIT_CENTRALITY_GROUP_HARMONIC_CLOSENESS_HPP_
#define NETWORKIT_CENTRALITY_GROUP_HARMONIC_CLOSENESS_HPP_

#include <memory>
#include <vector>

#include <networkit/base/Algorithm.hpp>
#include <networkit/graph/Graph.hpp>

namespace NetworKit {

class GroupHarmonicCloseness final : public Algorithm {

public:
    GroupHarmonicCloseness(const Graph &G, count k = 1);

    void run() override;

    const std::vector<node> &groupMaxHarmonicCloseness() const;

    template <class InputIt>
    static double scoreOfGroup(const Graph &graph, InputIt first, InputIt last);

    class GroupHarmonicClosenessInterface : public Algorithm {
    public:
        std::vector<node> group;
    };

private:
    const bool weighted;
    // Always one between GroupHarmonicClosenessUnweighted and GroupHarmonicClosenessWeighted, see
    // implementation.
    std::unique_ptr<GroupHarmonicClosenessInterface> impl;

    static double scoreOfGroup(const Graph &graph, const std::vector<node> &inputGroup);
};

template <class InputIt>
double GroupHarmonicCloseness::scoreOfGroup(const Graph &graph, InputIt first, InputIt last) {
    return scoreOfGroup(graph, {first, last});
}

} // namespace NetworKit

#endif // NETWORKIT_CENTRALITY_GROUP_HARMONIC_CLOSENESS_HPP_