Program Listing for File AffectedNodes.hpp

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

/*
 * File:   AffectedNodes.hpp
 * Author: paddya
 *
 * Created on 17. Dezember 2016, 16:35
 */

#ifndef NETWORKIT_DISTANCE_AFFECTED_NODES_HPP_
#define NETWORKIT_DISTANCE_AFFECTED_NODES_HPP_

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

namespace NetworKit {

class AffectedNodes : public Algorithm {
public:
    AffectedNodes(const Graph &G, const GraphEvent &event);
    void run() override;
    std::vector<node> getNodes();
    std::vector<edgeweight> getDistances();
    std::vector<edgeweight> getImprovements();

    edgeweight closenessU = 0;
    edgeweight closenessV = 0;
    edgeweight improvementU = 0;
    edgeweight improvementV = 0;

private:
    void addedEdge();
    void removedEdge();
    std::vector<edgeweight> bfsWithoutStartNeighbor(node source, node startNeighbor);

    std::vector<edgeweight> reverseBfsWithoutStartNeighbor(node source, node startNeighbor);

    std::pair<std::vector<node>, std::vector<edgeweight>>
    getAffectedNodes(node source, std::vector<edgeweight> &distances,
                     node additionalStartNeighbor = none);

    std::pair<std::vector<node>, std::vector<edgeweight>>
    getAffectedNodesBackwards(node source, std::vector<edgeweight> &distances,
                              node additionalStartNeighbor = none);
    const Graph &G;
    const GraphEvent &event;
    std::vector<node> nodes;
    std::vector<edgeweight> distances;
    std::vector<edgeweight> improvements;
};
} // namespace NetworKit

#endif // NETWORKIT_DISTANCE_AFFECTED_NODES_HPP_