summaryrefslogtreecommitdiffstats
path: root/src/libcola/shortest_paths.cpp
diff options
context:
space:
mode:
authorAndrew Higginson <at.higginson@gmail.com>2011-12-27 21:04:47 +0000
committerAndrew <at.higginson@gmail.com>2011-12-27 21:04:47 +0000
commit80960b623a99aae1402ab651b2974ef544ed3b03 (patch)
treeba49d42c2789e9e11f805e2d5263e10f9fedeef8 /src/libcola/shortest_paths.cpp
parenttry to fix bug (diff)
parentGDL: Cherry-pick upstream patch 73852 (2011-03-23) - Add missing return value. (diff)
downloadinkscape-80960b623a99aae1402ab651b2974ef544ed3b03.tar.gz
inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.zip
merged with trunk so I can build again...
(bzr r10092.1.36)
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]);
}
}
}