projects
/
mtp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
34022d5
)
Cleaned up comments.
author
Francois Fleuret
<francois@fleuret.org>
Sun, 26 Aug 2012 06:30:42 +0000
(08:30 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Sun, 26 Aug 2012 06:30:42 +0000
(08:30 +0200)
mtp_graph.cc
patch
|
blob
|
history
diff --git
a/mtp_graph.cc
b/mtp_graph.cc
index
9a811bb
..
473d13e
100644
(file)
--- a/
mtp_graph.cc
+++ b/
mtp_graph.cc
@@
-232,7
+232,7
@@
int MTPGraph::is_dag() {
}
new_front_size = 0;
}
new_front_size = 0;
- // We remove all
vertex
without incoming edge
+ // We remove all
the vertices
without incoming edge
for(int f = 0; f < front_size; f++) {
v = _front[f];
if(v->iteration == iteration) {
for(int f = 0; f < front_size; f++) {
v = _front[f];
if(v->iteration == iteration) {
@@
-247,8
+247,10
@@
int MTPGraph::is_dag() {
return front_size == 0;
}
return front_size == 0;
}
-// This method does not change the edge occupation. It update
-// distance_from_source and pred_edge_toward_source.
+// This method does not change the edge occupation. It only set
+// properly for every vertex the fields distance_from_source and
+// pred_edge_toward_source.
+
void MTPGraph::find_shortest_path() {
Vertex **tmp_front;
int tmp_front_size;
void MTPGraph::find_shortest_path() {
Vertex **tmp_front;
int tmp_front_size;
@@
-312,8
+314,9
@@
void MTPGraph::find_best_paths(scalar_t *lengths) {
// Let's be a bit paranoid
ASSERT(is_dag());
// Let's be a bit paranoid
ASSERT(is_dag());
- // We use one iteration of find_shortest_path simply to propagate
- // the distance to make all the edge lengths positive.
+ // We use call find_shortest_path here to set properly the distance,
+ // so that we can make all the edge lengths positive at the first
+ // iteration.
find_shortest_path();
do {
find_shortest_path();
do {
@@
-323,7
+326,7
@@
void MTPGraph::find_best_paths(scalar_t *lengths) {
total_length = 0.0;
total_length = 0.0;
- // Do we reach the
_
sink?
+ // Do we reach the sink?
if(_sink->pred_edge_toward_source) {
// If yes, compute the length of the best path
v = _sink;
if(_sink->pred_edge_toward_source) {
// If yes, compute the length of the best path
v = _sink;