49template<
typename TCost>
51 for (
node v : G.nodes) {
52 bfs_SPSS(v, G, distance[v], edgeCosts);
62template<
typename TCost>
69 distanceArray[s] = TCost(0);
70 while (!bfs.
empty()) {
72 TCost d = distanceArray[w] + edgeCosts;
74 node v = adj->twinNode();
92template<
typename TCost>
97 for (
edge e : G.edges) {
99 avgCosts += edgeCosts[e];
102 return avgCosts / G.numberOfEdges();
111template<
typename TCost>
114 for (
node v : G.nodes) {
127template<
typename TCost>
132 sssp.
call(G, edgeCosts, s, predecessor, shortestPathMatrix);
142template<
typename TCost>
144 for (
node u : G.nodes) {
145 for (
node v : G.nodes) {
146 for (
node w : G.nodes) {
148 shortestPathMatrix[u][v] + shortestPathMatrix[u][w]);
Includes declaration of graph class.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Decralation of GraphElement and GraphList classes.
Declaration of singly linked lists and iterators.
Class for adjacency list elements.
Dijkstra's single source shortest path algorithm.
void call(const Graph &G, const EdgeArray< T > &weight, const List< node > &sources, NodeArray< edge > &predecessor, NodeArray< T > &distance, bool directed=false, bool arcsReversed=false, node target=nullptr, T maxLength=std::numeric_limits< T >::max())
Calculates, based on the graph G with corresponding edge costs and source nodes, the shortest paths a...
Class for the representation of edges.
Stores additional attributes of a graph (like layout information).
const Graph & constGraph() const
Returns a reference to the associated graph.
double doubleWeight(edge e) const
Returns the (real number) weight of edge e.
Data type for general directed graphs (adjacency list representation).
Class for the representation of nodes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
bool empty() const
Returns true iff the list is empty.
E popFrontRet()
Removes the first element from the list and returns it.
iterator pushBack(const E &x)
Adds element x at the end of the list.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
RegisteredArray for nodes, edges and adjEntries of a graph.
Implementation of Dijkstra's single source shortest path algorithm.
void bfs_SPAP(const Graph &G, NodeArray< NodeArray< TCost > > &distance, TCost edgeCosts)
Computes all-pairs shortest paths in G using breadth-first serach (BFS).
void floydWarshall_SPAP(NodeArray< NodeArray< TCost > > &shortestPathMatrix, const Graph &G)
Computes all-pairs shortest paths in graph G using Floyd-Warshall's algorithm.
void bfs_SPSS(node s, const Graph &G, NodeArray< TCost > &distanceArray, TCost edgeCosts)
Computes single-source shortest paths from s in G using breadth-first search (BFS).
void dijkstra_SPSS(node s, const Graph &G, NodeArray< TCost > &shortestPathMatrix, const EdgeArray< TCost > &edgeCosts)
Computes single-source shortest paths from node s in G using Disjkstra's algorithm.
double dijkstra_SPAP(const GraphAttributes &GA, NodeArray< NodeArray< TCost > > &shortestPathMatrix)
Computes all-pairs shortest paths in GA using Dijkstra's algorithm.
void updateMin(T &min, const T &newValue)
Stores the minimum of min and newValue in min.
The namespace for all OGDF objects.