summaryrefslogtreecommitdiffstats
path: root/src/libcola/shortest_paths.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-07-06 01:59:32 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2011-07-06 01:59:32 +0000
commite65a02ed32b78534739aba24929ece7c44dd967f (patch)
tree13cf022f18f6b5bae46aad4bc339e512f069a514 /src/libcola/shortest_paths.cpp
parentPull 2Geom revision 2013 (extra constructors for Rect). (diff)
parentText edit dialog: Apply button should grab default only after adding to window (diff)
downloadinkscape-e65a02ed32b78534739aba24929ece7c44dd967f.tar.gz
inkscape-e65a02ed32b78534739aba24929ece7c44dd967f.zip
Merge from trunk
(bzr r10347.1.5)
Diffstat (limited to '')
-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]);
}
}
}