|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
49 template<
typename TCost>
51 for (
node v : G.nodes) {
52 bfs_SPSS(v, G, distance[v], edgeCosts);
62 template<
typename TCost>
69 distanceArray[s] = TCost(0);
70 while (!bfs.
empty()) {
72 TCost d = distanceArray[w] + edgeCosts;
92 template<
typename TCost>
97 for (
edge e : G.edges) {
99 avgCosts += edgeCosts[e];
102 return avgCosts / G.numberOfEdges();
111 template<
typename TCost>
114 for (
node v : G.nodes) {
127 template<
typename TCost>
132 sssp.
call(G, edgeCosts, s, predecessor, shortestPathMatrix);
142 template<
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]);
The namespace for all OGDF objects.
Stores additional attributes of a graph (like layout information).
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Includes declaration of graph class.
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 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).
const Graph & constGraph() const
Returns a reference to the associated graph.
Class for adjacency list elements.
void floydWarshall_SPAP(NodeArray< NodeArray< TCost >> &shortestPathMatrix, const Graph &G)
Computes all-pairs shortest paths in graph G using Floyd-Warshall's algorithm.
bool empty() const
Returns true iff the list is empty.
Dijkstra's single source shortest path algorithm.
Declaration of singly linked lists and iterators.
Decralation of GraphElement and GraphList classes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
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...
void updateMin(T &min, const T &newValue)
Stores the minimum of min and newValue in min.
double dijkstra_SPAP(const GraphAttributes &GA, NodeArray< NodeArray< TCost >> &shortestPathMatrix)
Computes all-pairs shortest paths in GA using Dijkstra's algorithm.
RegisteredArray for nodes, edges and adjEntries of a graph.
Data type for general directed graphs (adjacency list representation).
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
E popFrontRet()
Removes the first element from the list and returns it.
Class for the representation of edges.
Implementation of Dijkstra's single source shortest path algorithm.
iterator pushBack(const E &x)
Adds element x at the end of the list.
double doubleWeight(edge e) const
Returns the (real number) weight of edge e.
Class for the representation of nodes.
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.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.