projects
/
mtp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0a6d075
)
Cosmetics.
author
Francois Fleuret
<francois@fleuret.org>
Tue, 1 Jan 2013 23:04:41 +0000
(
00:04
+0100)
committer
Francois Fleuret
<francois@fleuret.org>
Tue, 1 Jan 2013 23:04:41 +0000
(
00:04
+0100)
mtp_graph.cc
patch
|
blob
|
history
diff --git
a/mtp_graph.cc
b/mtp_graph.cc
index
983e3a0
..
a03f60e
100644
(file)
--- a/
mtp_graph.cc
+++ b/
mtp_graph.cc
@@
-275,6
+275,7
@@
void MTPGraph::dp_compute_distances() {
// pred_edge_toward_source.
void MTPGraph::find_shortest_path() {
// pred_edge_toward_source.
void MTPGraph::find_shortest_path() {
+ int heap_size;
Vertex *v, *tv, **last_slot;
Edge *e;
scalar_t d;
Vertex *v, *tv, **last_slot;
Edge *e;
scalar_t d;
@@
-284,11
+285,11
@@
void MTPGraph::find_shortest_path() {
_vertices[k].pred_edge_toward_source = 0;
}
_vertices[k].pred_edge_toward_source = 0;
}
-
int
heap_size = _nb_vertices;
+ heap_size = _nb_vertices;
_source->distance_from_source = 0;
_source->decrease_distance_in_heap(_heap);
_source->distance_from_source = 0;
_source->decrease_distance_in_heap(_heap);
- while(heap_size >
0
) {
+ while(heap_size >
1
) {
// Get the closest to the source
v = _heap[0];
// Get the closest to the source
v = _heap[0];
@@
-297,7
+298,7
@@
void MTPGraph::find_shortest_path() {
heap_size--;
last_slot = _heap + heap_size;
swap(*_heap, *last_slot); swap((*_heap)->heap_slot, (*last_slot)->heap_slot);
heap_size--;
last_slot = _heap + heap_size;
swap(*_heap, *last_slot); swap((*_heap)->heap_slot, (*last_slot)->heap_slot);
-
_heap[0]
->increase_distance_in_heap(_heap, last_slot);
+
(*_heap)
->increase_distance_in_heap(_heap, last_slot);
// Now update the neighbors of the node currently closest to the
// source
// Now update the neighbors of the node currently closest to the
// source