]> git.lyx.org Git - lyx.git/blobdiff - src/Graph.cpp
*doxy
[lyx.git] / src / Graph.cpp
index c5e13ad214f92c1f2ad6770aea630740752524d0..da7170b2cba91a050a4a11c139bf460e896742ec 100644 (file)
@@ -178,9 +178,8 @@ Graph::EdgePath const Graph::getPath(int from, int to)
                int const current = Q_.front();
                Q_.pop();
 
-               vector<Arrow *>::const_iterator const beg =
+               vector<Arrow *>::const_iterator cit =
                        vertices_[current].out_arrows.begin();
-               vector<Arrow *>::const_iterator cit = beg;
                vector<Arrow *>::const_iterator end =
                        vertices_[current].out_arrows.end();
                for (; cit != end; ++cit) {
@@ -217,17 +216,20 @@ void Graph::getMarkedPath(int from, int to, EdgePath & path) {
        }
        // find marked in_arrow
        vector<Arrow *>::const_iterator it = vertices_[to].in_arrows.begin();
-       vector<Arrow *>::const_iterator en = vertices_[to].in_arrows.end();
+       vector<Arrow *>::const_iterator const en = vertices_[to].in_arrows.end();
        for (; it != en; ++it)
                if ((*it)->marked) 
                        break;
        if (it == en) {
+               // debug code to try to figure out what's up.
+               LYXERR0("Failed to find marked arrow.\n"
+                                               "From: " << from << ", To: " << to);
+               dumpGraph();
                LASSERT(false, /* */);
                return;
        }
-       int const newnode = (*it)->from;
-       path.push_back(newnode);
-       getMarkedPath(from, newnode, path);
+       path.push_back((*it)->id);
+       getMarkedPath(from, (*it)->from, path);
 }
 
        
@@ -249,4 +251,26 @@ void Graph::addEdge(int from, int to)
 }
 
 
+void Graph::dumpGraph() const
+{
+       vector<Vertex>::const_iterator it = vertices_.begin();
+       vector<Vertex>::const_iterator en = vertices_.end();
+       for (; it != en; ++it) {
+               LYXERR0("Next vertex...");
+               LYXERR0("In arrows...");
+               std::vector<Arrow *>::const_iterator iit = it->in_arrows.begin();
+               std::vector<Arrow *>::const_iterator ien = it->in_arrows.end();
+               for (; iit != ien; ++iit)
+                       LYXERR0("From " << (*iit)->from << " to " << (*iit)->to
+                                       << ". Marked: " << (*iit)->marked);
+               LYXERR0("Out arrows...");
+               iit = it->out_arrows.begin();
+               ien = it->out_arrows.end();
+               for (; iit != ien; ++iit)
+                       LYXERR0("From " << (*iit)->from << " to " << (*iit)->to
+                                               << ". Marked: " << (*iit)->marked);
+       }
+}
+
+
 } // namespace lyx