Program Listing for File NeighborhoodFunctionHeuristic.hpp

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

/*
 * NeighborhoodFunctionHeuristic.hpp
 *
 *      Author: Maximilian Vogel
 */

#ifndef NETWORKIT_DISTANCE_NEIGHBORHOOD_FUNCTION_HEURISTIC_HPP_
#define NETWORKIT_DISTANCE_NEIGHBORHOOD_FUNCTION_HEURISTIC_HPP_

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

namespace NetworKit {

class NeighborhoodFunctionHeuristic final : public Algorithm {

public:
    enum SelectionStrategy { RANDOM, SPLIT };
    NeighborhoodFunctionHeuristic(const Graph &G, count nSamples = 0,
                                  SelectionStrategy strategy = SPLIT);

    void run() override;

    const std::vector<count> &getNeighborhoodFunction() const;

private:
    const Graph *G;
    const count nSamples;
    const SelectionStrategy strategy;
    std::vector<count> result;

    /* selection schemes implemented as private functions */
    std::vector<node> random(const Graph &G, count nSamples);
    std::vector<node> split(const Graph &G, count nSamples);
};

} /* namespace NetworKit */

#endif // NETWORKIT_DISTANCE_NEIGHBORHOOD_FUNCTION_HEURISTIC_HPP_