Class APSP

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class APSP : public NetworKit::Algorithm

Class for all-pair shortest path algorithm.

Subclassed by NetworKit::DynAPSP

Public Functions

APSP(const Graph &G)

Creates the APSP class for G.


G – The graph.

~APSP() override = default
virtual void run() override

Computes the shortest paths from each node to all other nodes. The algorithm is parallel.

inline const std::vector<std::vector<edgeweight>> &getDistances() const

Returns a vector of weighted distances between node pairs.


The shortest-path distances from each node to any other node in the graph.

inline edgeweight getDistance(node u, node v) const

Returns the distance from u to v or infinity if u and v are not connected.

Protected Attributes

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