Program Listing for File DynBFS.hpp

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

/*
 * DynBFS.hpp
 *
 *  Created on: 17.07.2014
 *      Author: cls, ebergamini
 */

#ifndef NETWORKIT_DISTANCE_DYN_BFS_HPP_
#define NETWORKIT_DISTANCE_DYN_BFS_HPP_

#include <networkit/distance/DynSSSP.hpp>

namespace NetworKit {

class DynBFS final : public DynSSSP {

    static constexpr edgeweight infDist = std::numeric_limits<edgeweight>::max();

public:
    DynBFS(const Graph &G, node s, bool storePredecessors = true);

    void run() override;

    void update(GraphEvent e) override;

    void updateBatch(const std::vector<GraphEvent> &batch) override;

    /* Returns the number of shortest paths to node t.*/
    bigfloat getNumberOfPaths(node t) const;

private:
    enum Color { WHITE, BLACK, GRAY };
    std::vector<Color> color;
    count maxDistance;
};

inline bigfloat DynBFS::getNumberOfPaths(node t) const {
    return npaths[t];
}

} /* namespace NetworKit */

#endif // NETWORKIT_DISTANCE_DYN_BFS_HPP_