| 1 |
/* |
|---|
| 2 |
* Shooting* shortest path algorithm for PostgreSQL |
|---|
| 3 |
* |
|---|
| 4 |
* Copyright (c) 2007 Anton A. Patrushev, Orkney, Inc. |
|---|
| 5 |
* |
|---|
| 6 |
* This program is free software; you can redistribute it and/or modify |
|---|
| 7 |
* it under the terms of the GNU General Public License as published by |
|---|
| 8 |
* the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 |
* (at your option) any later version. |
|---|
| 10 |
* |
|---|
| 11 |
* This program is distributed in the hope that it will be useful, |
|---|
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 |
* GNU General Public License for more details. |
|---|
| 15 |
* |
|---|
| 16 |
* You should have received a copy of the GNU General Public License |
|---|
| 17 |
* along with this program; if not, write to the Free Software |
|---|
| 18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 19 |
* |
|---|
| 20 |
*/ |
|---|
| 21 |
|
|---|
| 22 |
#define _SHOOTING_STAR_H |
|---|
| 23 |
#define MAX_RULE_LENGTH 5 |
|---|
| 24 |
|
|---|
| 25 |
#include "postgres.h" |
|---|
| 26 |
|
|---|
| 27 |
typedef struct edge_shooting_star |
|---|
| 28 |
{ |
|---|
| 29 |
int id; |
|---|
| 30 |
int source; |
|---|
| 31 |
int target; |
|---|
| 32 |
float8 cost; |
|---|
| 33 |
float8 reverse_cost; |
|---|
| 34 |
float8 s_x; |
|---|
| 35 |
float8 s_y; |
|---|
| 36 |
float8 t_x; |
|---|
| 37 |
float8 t_y; |
|---|
| 38 |
float8 to_cost; |
|---|
| 39 |
int through_id[MAX_RULE_LENGTH]; |
|---|
| 40 |
int rule[MAX_RULE_LENGTH]; |
|---|
| 41 |
} edge_shooting_star_t; |
|---|
| 42 |
|
|---|
| 43 |
//I had to redeclare this. I couldn't include dijkstra.h 'cause |
|---|
| 44 |
//struct edge conflicts with function adjacency_list::edge() |
|---|
| 45 |
typedef struct path_element |
|---|
| 46 |
{ |
|---|
| 47 |
int vertex_id; |
|---|
| 48 |
int edge_id; |
|---|
| 49 |
float8 cost; |
|---|
| 50 |
} path_element_t; |
|---|
| 51 |
|
|---|
| 52 |
#ifdef __cplusplus |
|---|
| 53 |
extern "C" |
|---|
| 54 |
{ |
|---|
| 55 |
#endif |
|---|
| 56 |
int boost_shooting_star(edge_shooting_star_t *edges, unsigned int count, |
|---|
| 57 |
int source_edge_id, int target_edge_id, |
|---|
| 58 |
bool directed, bool has_reverse_cost, |
|---|
| 59 |
path_element_t **path, int *path_count, char **err_msg, |
|---|
| 60 |
int e_max_id); |
|---|
| 61 |
#ifdef __cplusplus |
|---|
| 62 |
} |
|---|
| 63 |
#endif |
|---|