| 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 | #define MAX_NODES 1000000 |
|---|
| 26 | #define MAX_COST 100000 |
|---|
| 27 | |
|---|
| 28 | #include "postgres.h" |
|---|
| 29 | |
|---|
| 30 | typedef struct edge_shooting_star |
|---|
| 31 | { |
|---|
| 32 | int id; |
|---|
| 33 | int source; |
|---|
| 34 | int target; |
|---|
| 35 | float8 cost; |
|---|
| 36 | float8 reverse_cost; |
|---|
| 37 | float8 s_x; |
|---|
| 38 | float8 s_y; |
|---|
| 39 | float8 t_x; |
|---|
| 40 | float8 t_y; |
|---|
| 41 | float8 to_cost; |
|---|
| 42 | int through_id[MAX_RULE_LENGTH]; |
|---|
| 43 | int rule[MAX_RULE_LENGTH]; |
|---|
| 44 | } edge_shooting_star_t; |
|---|
| 45 | |
|---|
| 46 | //I had to redeclare this. I couldn't include dijkstra.h 'cause |
|---|
| 47 | //struct edge conflicts with function adjacency_list::edge() |
|---|
| 48 | typedef struct path_element |
|---|
| 49 | { |
|---|
| 50 | int vertex_id; |
|---|
| 51 | int edge_id; |
|---|
| 52 | float8 cost; |
|---|
| 53 | } path_element_t; |
|---|
| 54 | |
|---|
| 55 | #ifdef __cplusplus |
|---|
| 56 | extern "C" |
|---|
| 57 | { |
|---|
| 58 | #endif |
|---|
| 59 | int boost_shooting_star(edge_shooting_star_t *edges, unsigned int count, |
|---|
| 60 | int source_edge_id, int target_edge_id, |
|---|
| 61 | bool directed, bool has_reverse_cost, |
|---|
| 62 | path_element_t **path, int *path_count, char **err_msg, |
|---|
| 63 | int e_max_id); |
|---|
| 64 | #ifdef __cplusplus |
|---|
| 65 | } |
|---|
| 66 | #endif |
|---|