pgr_apspJohnson¶
Name¶
pgr_apspJohnson - Returns all costs for each pair of nodes in the graph.
Warning
This function is deprecated in version 2.2 Use pgr_johnson instead
Synopsis¶
Johnson’s algorithm is a way to find the shortest paths between all pairs of vertices in a sparse, edge weighted, directed graph. Returns a set of pgr_costResult (seq, id1, id2, cost) rows for every pair of nodes in the graph.
pgr_costResult[] pgr_apspJohnson(sql text);
Description¶
sql: | a SQL query that should return the edges for the graph that will be analyzed: SELECT source, target, cost FROM edge_table;
|
---|
Returns set of pgr_costResult[]:
seq: | row sequence |
---|---|
id1: | source node ID |
id2: | target node ID |
cost: | cost to traverse from id1 to id2 |
History
- Deprecated in version 2.2.0
- New in version 2.0.0
Examples¶
SELECT * FROM pgr_apspJohnson(
'SELECT source::INTEGER, target::INTEGER, cost FROM edge_table WHERE id < 5'
);
NOTICE: Deprecated function: Use pgr_johnson instead
seq | id1 | id2 | cost
-----+-----+-----+------
0 | 1 | 2 | 1
1 | 1 | 5 | 2
2 | 2 | 5 | 1
(3 rows)
The query uses the Sample Data network.