summaryrefslogtreecommitdiffstats
path: root/src/libcola/shortest_paths.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2011-07-02 06:11:08 +0000
committerJon A. Cruz <jon@joncruz.org>2011-07-02 06:11:08 +0000
commit07c8dea2b0361314ac4bbf0e45dd4c33ce11f206 (patch)
treed5452b36543452b5e79e9c7c688c897a6b87dfe8 /src/libcola/shortest_paths.cpp
parentcompatibility for building with clang, this failed for 2 reasons. (diff)
downloadinkscape-07c8dea2b0361314ac4bbf0e45dd4c33ce11f206.tar.gz
inkscape-07c8dea2b0361314ac4bbf0e45dd4c33ce11f206.zip
Applying patch from Campbell Barton to help building on other than gcc.
(bzr r10399)
Diffstat (limited to 'src/libcola/shortest_paths.cpp')
-rw-r--r--src/libcola/shortest_paths.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/libcola/shortest_paths.cpp b/src/libcola/shortest_paths.cpp
index 4f4183b07..ebc2c93de 100644
--- a/src/libcola/shortest_paths.cpp
+++ b/src/libcola/shortest_paths.cpp
@@ -73,6 +73,7 @@ void dijkstra(
}
}
}
+
void dijkstra(
unsigned s,
unsigned n,
@@ -80,21 +81,22 @@ void dijkstra(
vector<Edge>& es,
double* eweights)
{
- assert(s<n);
- Node vs[n];
- dijkstra_init(vs,es,eweights);
- dijkstra(s,n,vs,d);
+ assert(s < n);
+ std::vector<Node> vs(n);
+ dijkstra_init(&vs[0], es, eweights);
+ dijkstra(s, n, &vs[0], d);
}
+
void johnsons(
unsigned n,
double** D,
vector<Edge>& es,
double* eweights)
{
- Node vs[n];
- dijkstra_init(vs,es,eweights);
- for(unsigned k=0;k<n;k++) {
- dijkstra(k,n,vs,D[k]);
+ std::vector<Node> vs(n);
+ dijkstra_init(&vs[0], es, eweights);
+ for (unsigned k = 0; k < n; k++) {
+ dijkstra(k,n,&vs[0],D[k]);
}
}
}