Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56454 - trunk/boost/graph/detail
From: jewillco_at_[hidden]
Date: 2009-09-28 11:40:25


Author: jewillco
Date: 2009-09-28 11:40:24 EDT (Mon, 28 Sep 2009)
New Revision: 56454
URL: http://svn.boost.org/trac/boost/changeset/56454

Log:
Fixed bug in CSR edges() function
Text files modified:
   trunk/boost/graph/detail/compressed_sparse_row_struct.hpp | 13 +++++++------
   1 files changed, 7 insertions(+), 6 deletions(-)

Modified: trunk/boost/graph/detail/compressed_sparse_row_struct.hpp
==============================================================================
--- trunk/boost/graph/detail/compressed_sparse_row_struct.hpp (original)
+++ trunk/boost/graph/detail/compressed_sparse_row_struct.hpp 2009-09-28 11:40:24 EDT (Mon, 28 Sep 2009)
@@ -468,7 +468,7 @@
   class csr_edge_iterator
     : public iterator_facade<csr_edge_iterator<CSRGraph>,
                              typename CSRGraph::edge_descriptor,
- std::input_iterator_tag,
+ boost::forward_traversal_tag,
                              typename CSRGraph::edge_descriptor>
   {
    private:
@@ -481,7 +481,7 @@
     csr_edge_iterator(const CSRGraph& graph,
                       edge_descriptor current_edge,
                       EdgeIndex end_of_this_vertex)
- : rowstart_array(&graph.m_forward.m_rowstart[0]), current_edge(current_edge),
+ : rowstart_array(&graph.m_forward.m_rowstart), current_edge(current_edge),
         end_of_this_vertex(end_of_this_vertex) {}
 
    public: // See above
@@ -495,13 +495,14 @@
 
     void increment() {
       ++current_edge.idx;
- while (current_edge.idx == end_of_this_vertex) {
+ while (current_edge.idx == end_of_this_vertex &&
+ current_edge.src + 1 < rowstart_array->size()) {
         ++current_edge.src;
- end_of_this_vertex = rowstart_array[current_edge.src + 1];
+ end_of_this_vertex = (*rowstart_array)[current_edge.src + 1];
       }
     }
 
- const EdgeIndex* rowstart_array;
+ const std::vector<EdgeIndex>* rowstart_array;
     edge_descriptor current_edge;
     EdgeIndex end_of_this_vertex;
   };
@@ -511,7 +512,7 @@
   class csr_in_edge_iterator
     : public iterator_facade<csr_in_edge_iterator<CSRGraph>,
                              typename CSRGraph::edge_descriptor,
- std::input_iterator_tag,
+ boost::forward_traversal_tag,
                              typename CSRGraph::edge_descriptor>
   {
    public:


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk