23 #include <sys/types.h>
68 printf(
"clipper called:\n");
69 printf(
" from node: %ld - attributes x=%ld y=%ld z=%ld\n",
72 printf(
" to node: %ld - attributes x=%ld y=%ld z=%ld\n",
94 int main(
int argc,
char **argv)
117 GNO_OPTION(
"v",
"version",
NULL, &pszVersion,
"alter graph version")
121 "node to discard in clipper")
123 "Report shortest distance only")
125 "Unflatten the graph before processing")
133 if (pszFilein ==
NULL || pszFrom ==
NULL || pszTo ==
NULL) {
146 version = atoi(pszVersion);
149 fd = open(pszFilein, O_RDONLY);
160 fprintf(stderr,
"dglRead error: %s\n",
dglStrerror(&graph));
170 from = atol(pszFrom);
173 printf(
"shortest path: from-node %ld - to-node %ld\n\n", from, to);
177 if (fDistance ==
False) {
183 printf(
"destination node is unreachable\n\n");
186 fprintf(stderr,
"dglShortestPath error: %s\n",
193 (
"shortest path report: total edges %ld - total distance %ld\n",
196 for (i = 0; i < pReport->
cArc; i++) {
197 printf(
"edge[%d]: from %ld to %ld - travel cost %ld - user edgeid %ld - distance from start node %ld\n", i, pReport->
pArc[i].
nFrom, pReport->
pArc[i].
nTo,
dglEdgeGet_Cost(&graph, pReport->
pArc[i].
pnEdge),
211 printf(
"destination node is unreachable\n\n");
215 fprintf(stderr,
"dglShortestDistance error: %s\n",
219 printf(
"shortest distance: %ld\n", nDistance);