Program Listing for File GroupClosenessLocalSearch.hpp

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

#ifndef NETWORKIT_CENTRALITY_GROUP_CLOSENESS_LOCAL_SEARCH_HPP_
#define NETWORKIT_CENTRALITY_GROUP_CLOSENESS_LOCAL_SEARCH_HPP_

#include <limits>
#include <memory>
#include <vector>

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

namespace NetworKit {

class GroupClosenessLocalSearch final : public Algorithm {
public:
    template <class InputIt>
    GroupClosenessLocalSearch(const Graph &G, InputIt first, InputIt last,
                              bool runGrowShrink = true,
                              count maxIterations = std::numeric_limits<count>::max())
        : GroupClosenessLocalSearch(G, std::vector<node>(first, last), runGrowShrink,
                                    maxIterations) {}

    GroupClosenessLocalSearch(const Graph &G, const std::vector<node> &group,
                              bool runGrowShrink = true,
                              count maxIterations = std::numeric_limits<count>::max());

    void run() override;

    std::vector<node> groupMaxCloseness() const;

    count numberOfIterations() const;

    class GroupClosenessLocalSearchInterface : public Algorithm {
    public:
        template <class InputIt>
        GroupClosenessLocalSearchInterface(InputIt first, InputIt last) : group(first, last) {}

        std::unordered_set<node> group;
        count nIterations;
    };

private:
    const bool weighted;
    // Is always one between GroupClosenessLocalSearchImpl<count/edgeweight>,
    // see implementation.
    std::unique_ptr<GroupClosenessLocalSearchInterface> impl;
};

} // namespace NetworKit

#endif // NETWORKIT_CENTRALITY_GROUP_CLOSENESS_LOCAL_SEARCH_HPP_