Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ To see all issues & pull requests closed by this release see the
* [#3055](https://github.com/pgRouting/pgrouting/issues/3055): bdDijkstra: use the shortest_path process and driver
* [#3056](https://github.com/pgRouting/pgrouting/issues/3056): edwardMoore: use the shortest_path process and driver
* [#3060](https://github.com/pgRouting/pgrouting/issues/3060): dagShortestPath: use the shortest_path process and driver
* [#3064](https://github.com/pgRouting/pgrouting/issues/3064): Astar: create and use a process and driver for Astar

## pgRouting 4.0

Expand Down
1 change: 1 addition & 0 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ To see all issues & pull requests closed by this release see the
* :issue:`3055`: bdDijkstra: use the shortest_path process and driver
* :issue:`3056`: edwardMoore: use the shortest_path process and driver
* :issue:`3060`: dagShortestPath: use the shortest_path process and driver
* :issue:`3064`: Astar: create and use a process and driver for Astar

pgRouting 4.0
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
4 changes: 3 additions & 1 deletion include/c_common/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ enum Which {
/** allpairs **/
FLOYD = 31, JOHNSON,
/** metrics **/
BANDWIDTH
BANDWIDTH,
/** with edges that have x y */
ASTAR = 400, BDASTAR
};
Comment thread
coderabbitai[bot] marked this conversation as resolved.

#endif // INCLUDE_C_COMMON_ENUMS_H_
1 change: 1 addition & 0 deletions include/cpp_common/utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
namespace pgrouting {

std::string get_name(Which);
std::string get_name(Which, bool, bool);
std::string get_name(Which, bool, bool, bool);
char estimate_drivingSide(char, Which);
void get_new_queries(const std::string&, const std::string&, std::string&, std::string&);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/*PGR-GNU*****************************************************************
File: bdAstar_driver.h
File: astar_driver.hpp

Generated with Template by:
Copyright (c) 2007-2026 pgRouting developers
Mail: project@pgrouting.org

Function's developer:
Copyright (c) 2015 Celia Virginia Vergara Castillo
Mail: vicky_vergara@hotmail.com
Design of one process & driver file by
Copyright (c) 2026 Celia Virginia Vergara Castillo
Mail: vicky at erosion.dev

------

Expand All @@ -27,51 +26,38 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

********************************************************************PGR-GNU*/

#ifndef INCLUDE_DRIVERS_BDASTAR_BDASTAR_DRIVER_H_
#define INCLUDE_DRIVERS_BDASTAR_BDASTAR_DRIVER_H_
#ifndef INCLUDE_DRIVERS_ASTAR_DRIVER_HPP_
#define INCLUDE_DRIVERS_ASTAR_DRIVER_HPP_
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <postgres.h>
#include <utils/array.h>
#include <cstddef>
#include <cstdint>
#include <string>
#include <sstream>

#ifdef __cplusplus
}
#endif
#include "c_common/enums.h"

#include "cpp_common/undefPostgresDefine.hpp"

#ifdef __cplusplus
# include <cstddef>
# include <cstdint>
using Path_rt = struct Path_rt;
#else
# include <stddef.h>
# include <stdint.h>
typedef struct Path_rt Path_rt;
#endif

#ifdef __cplusplus
extern "C" {
#endif
using ArrayType = struct ArrayType;

void pgr_do_bdAstar(
const char*,
const char*,
ArrayType*, ArrayType*,
namespace pgrouting {
namespace drivers {

bool, int, double, double, bool,
void do_astar(
const std::string&, const std::string&,
ArrayType*, ArrayType*,

Path_rt**, size_t*,
bool, bool, bool,

char**, char**, char**);
int, double, double,

Which,
bool&,
Path_rt*&, size_t&,
std::ostringstream&, std::ostringstream&, std::ostringstream&);

#ifdef __cplusplus
}
#endif
} // namespace drivers
} // namespace pgrouting

#endif // INCLUDE_DRIVERS_BDASTAR_BDASTAR_DRIVER_H_
#endif // INCLUDE_DRIVERS_ASTAR_DRIVER_HPP_
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/*PGR-GNU*****************************************************************
File: astar_driver.h
File: astar_process.h

Copyright (c) 2007-2026 pgRouting developers
Mail: project@pgrouting.org

Function's developer:
Copyright (c) 2023 Celia Virginia Vergara Castillo
Copyright (c) 2015 Celia Virginia Vergara Castillo
Design of one process & driver file by
Copyright (c) 2026 Celia Virginia Vergara Castillo
Mail: vicky at erosion.dev

------
Expand All @@ -27,51 +26,42 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

********************************************************************PGR-GNU*/

#ifndef INCLUDE_DRIVERS_ASTAR_ASTAR_DRIVER_H_
#define INCLUDE_DRIVERS_ASTAR_ASTAR_DRIVER_H_
#ifndef INCLUDE_PROCESS_ASTAR_PROCESS_H_
#define INCLUDE_PROCESS_ASTAR_PROCESS_H_
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <postgres.h>
#include <utils/array.h>

#ifdef __cplusplus
}
#endif

#include "cpp_common/undefPostgresDefine.hpp"

#ifdef __cplusplus
# include <cstddef>
# include <cstdint>
#include <cstddef>
#include <cstdint>
using Path_rt = struct Path_rt;
using ArrayType = struct ArrayType;
#else
# include <stddef.h>
# include <stdint.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
typedef struct Path_rt Path_rt;
typedef struct ArrayType ArrayType;
#endif

#include "c_common/enums.h"

#ifdef __cplusplus
extern "C" {
#endif

void pgr_do_astar(
const char*,
const char*,
ArrayType*,
ArrayType*,
void pgr_process_astar(
const char*, const char*,
ArrayType*, ArrayType*,

bool, int, double, double, bool, bool,
bool, bool, bool,

Path_rt**, size_t*,
char**, char**, char**);
int, double, double,

enum Which,
Path_rt**, size_t*);

#ifdef __cplusplus
}
#endif

#endif // INCLUDE_DRIVERS_ASTAR_ASTAR_DRIVER_H_
#endif // INCLUDE_PROCESS_ASTAR_PROCESS_H_
7 changes: 6 additions & 1 deletion locale/en/LC_MESSAGES/pgrouting_doc_strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pgRouting v4.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-07 19:07+0000\n"
"POT-Creation-Date: 2026-02-19 14:11+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -3951,6 +3951,11 @@ msgid ""
"dagShortestPath: use the shortest_path process and driver"
msgstr ""

msgid ""
"`#3064 <https://github.com/pgRouting/pgrouting/issues/3064>`__: Astar: "
"create and use a process and driver for Astar"
msgstr ""

msgid "All releases"
msgstr ""

Expand Down
5 changes: 4 additions & 1 deletion locale/pot/pgrouting_doc_strings.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pgRouting v4.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-07 19:07+0000\n"
"POT-Creation-Date: 2026-02-19 14:11+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -3544,6 +3544,9 @@ msgstr ""
msgid "`#3060 <https://github.com/pgRouting/pgrouting/issues/3060>`__: dagShortestPath: use the shortest_path process and driver"
msgstr ""

msgid "`#3064 <https://github.com/pgRouting/pgrouting/issues/3064>`__: Astar: create and use a process and driver for Astar"
msgstr ""

msgid "All releases"
msgstr ""

Expand Down
3 changes: 2 additions & 1 deletion pgtap/astar/aStarCostMatrix/no_crash_test.pg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
BEGIN;

UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost);
SELECT plan(15);
SELECT plan(16);

PREPARE edges_q AS
SELECT id, source, target, cost, reverse_cost, x1, y1, x2, y2 FROM edges;
Expand Down Expand Up @@ -49,6 +49,7 @@ LANGUAGE plpgsql VOLATILE;


SELECT * FROM test_function();
SELECT throw_on_empty_edges_sql('pgr_astarCostMatrix', ',ARRAY[5,6]');

SELECT finish();
ROLLBACK;
5 changes: 4 additions & 1 deletion pgtap/astar/astar/no_crash_test.pg
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ BEGIN;


UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost);
SELECT CASE WHEN min_version('3.2.0') THEN plan(97) ELSE plan(84) END;
SELECT CASE WHEN min_version('3.2.0') THEN plan(98) ELSE plan(85) END;

SELECT general_no_crash('pgr_aStar');
SELECT throw_on_empty_edges_sql('pgr_aStar', ',1,2');

SELECT finish();

ROLLBACK;
7 changes: 4 additions & 3 deletions pgtap/astar/astarCost/no_crash_test.pg
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ BEGIN;


UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost);
SELECT CASE WHEN min_version('3.2.0') THEN plan(97) ELSE plan(84) END;
SELECT CASE WHEN min_version('3.2.0') THEN plan(98) ELSE plan(85) END;


SELECT general_no_crash('pgr_aStar');
SELECT general_no_crash('pgr_aStarCost');
SELECT throw_on_empty_edges_sql('pgr_aStarCost', ',1,2');

SELECT finish();
ROLLBACK;

2 changes: 1 addition & 1 deletion sql/astar/astarCostMatrix.sql
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CREATE FUNCTION pgr_aStarCostMatrix(
RETURNS SETOF RECORD AS
$BODY$
SELECT a.start_vid, a.end_vid, a.agg_cost
FROM _pgr_astar(_pgr_get_statement($1), $2, $2, $3, $4, $5::FLOAT, $6::FLOAT, true) a;
FROM _pgr_astar(_pgr_get_statement($1), $2::BIGINT[], '{}'::BIGINT[], $3, $4, $5::FLOAT, $6::FLOAT, true) a;
$BODY$
LANGUAGE SQL VOLATILE STRICT
COST ${COST_HIGH} ROWS ${ROWS_HIGH};
Expand Down
2 changes: 1 addition & 1 deletion sql/bdAstar/bdAstarCostMatrix.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ CREATE FUNCTION pgr_bdAstarCostMatrix(
RETURNS SETOF RECORD AS
$BODY$
SELECT a.start_vid, a.end_vid, a.agg_cost
FROM _pgr_bdAstar(_pgr_get_statement($1), $2::BIGINT[], $2::BIGINT[], $3, $4, $5::FLOAT, $6::FLOAT, true) a;
FROM _pgr_bdAstar(_pgr_get_statement($1), $2::BIGINT[], '{}'::BIGINT[], $3, $4, $5::FLOAT, $6::FLOAT, true) a;
Comment thread
cvvergara marked this conversation as resolved.
$BODY$
LANGUAGE SQL VOLATILE STRICT
COST ${COST_HIGH} ROWS ${ROWS_HIGH};
Expand Down
4 changes: 3 additions & 1 deletion src/astar/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# This file is part of the pgRouting project.
# Copyright (c) 2007-2026 pgRouting developers
# License: GPL-2 See https://github.com/pgRouting/pgrouting/blob/main/LICENSE

ADD_LIBRARY(astar OBJECT
astar.c

astar_driver.cpp
)
astar_process.cpp
)
Loading