You are on page 1of 2
072016 ar_astar - Shortest Path A* — pgRouing Manual (200-ret) pgr_astar - Shortest Path A* | Name per_astar— Returns the shortest path using A* algorthm, ‘Synopsis ‘The A* (pronounced “A Star’) algorithm is based on Distra’s algorithm with a heuristic that allow i to solve mast shortest path problems by ‘evaluation only a sub-set ofthe overall graph, Returns a set of pgr_costResult (seq, dt, ld2, cost) rows, that make up a path. | per costResuit) per_astar(sal text, source integer, tera directed boolean, has_rcost beotean); Description sa: 2 SOL. query, which should return a set of rows with the following columns: rast, cost, Ma, ¥y 22, y2 [yevense_cost] FROM edge table ia inva identiir of the edge source: nea identifier of the source vertex target: inca identiier ofthe target vertex cost: ‘cate value, of the edge traversal cost. A negative cost will prevent the edge from being inserted inthe graph. xt x coordinate of the start point of the edge ” ¥y coordinate of the start pont of the edge x2: x coordinate ofthe end paint ofthe edge we y coordinate ofthe enc point of the edge (optional) she cost forthe reverse traversal ofthe edge. This is only used when the ctcectee and has_rcost parameters are true (sve the above remark about negative costs) source: ints id of the start point target: ints id of the end point directed: srueif he graph is directed hhas_roost: if true, the reverse_cost column of the SQL generated set of rows will be used for the cost ofthe traversal ofthe edge inthe opposite direction, Retums set of pgr_costResult - Path Result with Cost: seq: row sequence idt: node 1D 1d2: edge ID (-2 fr the last row) cost: cost to traverse from set using 142 History Renamed in version 2.0.0, Examples Without reverse cost i FROM per_astar(. ’ | i: % piidocs.pecutingorgv2.0.0-cisrclastaridocindexim! 1 072016 § (ows) With reverse_co | ROW per_astar( i: % “The queries use the Sample Data network. See Also ‘pgr_costResultf]- Path Result with Cost http:sen.wikipedia.orgiwiki/A*_search_algorithm bipitdocs pecusingorgv2.0.0-cisrclastaridocindextim! ar_astar - Shortest Path A* — pgRouing Manual (200-ret)

You might also like