|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62592 - in trunk: boost/graph boost/graph/detail libs/graph/test
From: jewillco_at_[hidden]
Date: 2010-06-08 15:07:53
Author: jewillco
Date: 2010-06-08 15:07:52 EDT (Tue, 08 Jun 2010)
New Revision: 62592
URL: http://svn.boost.org/trac/boost/changeset/62592
Log:
Added fixes and tests for CSR in_edge_iterator; fixes #4310, #4311
Text files modified:
trunk/boost/graph/compressed_sparse_row_graph.hpp | 4 ++--
trunk/boost/graph/detail/compressed_sparse_row_struct.hpp | 10 +++++-----
trunk/libs/graph/test/csr_graph_test.cpp | 4 ++++
3 files changed, 11 insertions(+), 7 deletions(-)
Modified: trunk/boost/graph/compressed_sparse_row_graph.hpp
==============================================================================
--- trunk/boost/graph/compressed_sparse_row_graph.hpp (original)
+++ trunk/boost/graph/compressed_sparse_row_graph.hpp 2010-06-08 15:07:52 EDT (Tue, 08 Jun 2010)
@@ -1275,8 +1275,8 @@
typedef typename BOOST_BIDIR_CSR_GRAPH_TYPE::in_edge_iterator it;
EdgeIndex v_row_start = g.m_backward.m_rowstart[v];
EdgeIndex next_row_start = g.m_backward.m_rowstart[v + 1];
- return std::make_pair(it(ed(v, v_row_start)),
- it(ed(v, next_row_start)));
+ return std::make_pair(it(g, v_row_start),
+ it(g, next_row_start));
}
template<BOOST_BIDIR_CSR_GRAPH_TEMPLATE_PARMS>
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 2010-06-08 15:07:52 EDT (Tue, 08 Jun 2010)
@@ -525,18 +525,18 @@
typedef typename CSRGraph::edges_size_type EdgeIndex;
typedef typename CSRGraph::edge_descriptor edge_descriptor;
- csr_in_edge_iterator() {}
+ csr_in_edge_iterator(): m_graph(0) {}
// Implicit copy constructor OK
csr_in_edge_iterator(const CSRGraph& graph,
EdgeIndex index_in_backward_graph)
- : m_graph(graph), m_index_in_backward_graph(index_in_backward_graph) {}
+ : m_index_in_backward_graph(index_in_backward_graph), m_graph(&graph) {}
public: // See above
// iterator_facade requirements
edge_descriptor dereference() const {
return edge_descriptor(
- m_graph.m_backward.m_column[m_index_in_backward_graph],
- m_graph.m_backward.m_edge_properties[m_index_in_backward_graph]);
+ m_graph->m_backward.m_column[m_index_in_backward_graph],
+ m_graph->m_backward.m_edge_properties[m_index_in_backward_graph]);
}
bool equal(const csr_in_edge_iterator& other) const
@@ -550,7 +550,7 @@
{ return other.m_index_in_backward_graph - m_index_in_backward_graph; }
EdgeIndex m_index_in_backward_graph;
- const CSRGraph& m_graph;
+ const CSRGraph* m_graph;
friend class iterator_core_access;
};
Modified: trunk/libs/graph/test/csr_graph_test.cpp
==============================================================================
--- trunk/libs/graph/test/csr_graph_test.cpp (original)
+++ trunk/libs/graph/test/csr_graph_test.cpp 2010-06-08 15:07:52 EDT (Tue, 08 Jun 2010)
@@ -462,6 +462,10 @@
assert_graphs_equal(g, boost::identity_property_map(),
g2b, boost::identity_property_map(),
boost::identity_property_map());
+ // Check in edge access
+ typedef boost::graph_traits<BidirCSRGraphT>::in_edge_iterator in_edge_iterator;
+ std::pair<in_edge_iterator, in_edge_iterator> ie(in_edges(vertex(0, g2b), g2b));
+
std::cout << "Testing CSR graph built using add_edges" << std::endl;
// Test building a graph using add_edges on unsorted lists
CSRGraphT g3(boost::edges_are_unsorted, unsorted_edges, unsorted_edges, 6); // Empty range
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