Program Listing for File DynPrunedLandmarkLabeling.hpp

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

#ifndef NETWORKIT_DISTANCE_DYN_PRUNED_LANDMARK_LABELING_HPP_
#define NETWORKIT_DISTANCE_DYN_PRUNED_LANDMARK_LABELING_HPP_

#include <stdexcept>
#include <vector>

#include <networkit/base/DynAlgorithm.hpp>
#include <networkit/distance/PrunedLandmarkLabeling.hpp>
#include <networkit/dynamics/GraphEvent.hpp>
#include <networkit/graph/Graph.hpp>

namespace NetworKit {

class DynPrunedLandmarkLabeling final : public PrunedLandmarkLabeling, public DynAlgorithm {

public:
    DynPrunedLandmarkLabeling(const Graph &G) : PrunedLandmarkLabeling(G) {}

    ~DynPrunedLandmarkLabeling() override = default;

    void update(GraphEvent e) override;

    void updateBatch(const std::vector<GraphEvent> &) override {
        throw std::runtime_error("Not implemented.");
    }

private:
    void addEdge(node u, node v);

    void prunedBFS(node k, node startNode, count bfsLevel, bool reverse);

    void sortUpdatedLabels(bool reverse);

    std::vector<node> updatedNodes;
};

} // namespace NetworKit

#endif // NETWORKIT_DISTANCE_DYN_PRUNED_LANDMARK_LABELING_HPP_