Program Listing for File APSP.hpp

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

/*
 * APSP.hpp
 *
 *  Created on: 07.07.2015
 *      Author: Arie Slobbe
 */

#ifndef NETWORKIT_DISTANCE_APSP_HPP_
#define NETWORKIT_DISTANCE_APSP_HPP_

#include <memory>

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

namespace NetworKit {

class APSP : public Algorithm {

public:
    APSP(const Graph &G);

    ~APSP() override = default;

    void run() override;

    const std::vector<std::vector<edgeweight>> &getDistances() const {
        assureFinished();
        return distances;
    }

    edgeweight getDistance(node u, node v) const {
        assureFinished();
        return distances[u][v];
    }

protected:
    const Graph &G;
    std::vector<std::vector<edgeweight>> distances;
    std::vector<std::unique_ptr<SSSP>> sssps;
};

} /* namespace NetworKit */

#endif // NETWORKIT_DISTANCE_APSP_HPP_