root/sandbox/sigis/christian.gonzalez/trunk/core/src/dijkstra.h

Revision 332, 1.6 KB (checked in by christian.gonzalez, 18 months ago)

- "has_reverse_cost" --> deprecated, no used by the function internally. Now however, with only passing the

argument "directed" and "reverse_cost" in the SQL does the same

- added parameter "bidirectional" --> it
- added file README.shortest_path.
- elog --> ereport.
- text2char --> eliminated, now using -->DatumGetCString(DirectFunctionCall?1(textout,PointerGetDatum?( ))).
- palloc --> SPI_palloc.
- repalloc --> SPI_repalloc.
- pfree --> SPI_pfree.
- the proccess for calculating the min_id was improved, now calculated in function "fetch_edge".
- minor improvements.
- added some comments.
- added some macro fucntions.
- added constant definitions.
- reorganized the source code

Line 
1/*
2 * Shortest path algorithm for PostgreSQL
3 *
4 * Copyright (c) 2005 Sylvain Pasche
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#ifndef _DIJKSTRA_H
23#define _DIJKSTRA_H
24
25#include "postgres.h"
26
27#define PGR_COLUMN_NOTEXIST (-1)
28
29/*
30 * Macro definition of special functions
31 */
32#define PGR_FUNC_MAX(A, B) ((A > B) ? A : B)
33#define PGR_FUNC_MIN(A, B) ((A < B) ? A : B)
34
35/*
36 *
37 */
38typedef struct edge_columns
39{
40  int id;
41  int source;
42  int target;
43  int cost;
44  int bidirectional;
45  int reverse_cost;
46} edge_columns_t;
47
48/*
49 *
50 */
51typedef struct edge
52{
53  int id;
54  int source;
55  int target;
56  float8 cost;
57  bool bidirectional;
58  float8 reverse_cost;
59} edge_t;
60
61/*
62 *
63 */
64typedef struct path_element
65{
66  int vertex_id;
67  int edge_id;
68  float8 cost;
69} path_element_t;
70
71/**
72 *
73 */
74#ifdef __cplusplus
75extern "C"
76#endif
77
78  int boost_dijkstra(edge_t *edges, unsigned int ntuplas, int start_vertex, int end_vertex,
79         bool directed, path_element_t **path, int *path_count, char **err_msg);
80
81#endif
82
Note: See TracBrowser for help on using the browser.