|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53786 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2009-06-10 10:43:13
Author: jewillco
Date: 2009-06-10 10:43:12 EDT (Wed, 10 Jun 2009)
New Revision: 53786
URL: http://svn.boost.org/trac/boost/changeset/53786
Log:
Sped up out_degree() and related functions for new interface
Text files modified:
trunk/boost/graph/compressed_sparse_row_graph.hpp | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 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 2009-06-10 10:43:12 EDT (Wed, 10 Jun 2009)
@@ -943,8 +943,14 @@
typedef typename BOOST_CSR_GRAPH_TYPE::out_edge_iterator it;
EdgeIndex v_row_start = g.m_rowstart[v];
EdgeIndex next_row_start = g.m_rowstart[v + 1];
+#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE
+ return std::make_pair(it(ed(v, v_row_start)),
+ it(ed(v, next_row_start)));
+#else
+ // Special case to allow incremental construction
return std::make_pair(it(ed(v, v_row_start)),
it(ed(v, (std::max)(v_row_start, next_row_start))));
+#endif
}
template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
@@ -953,7 +959,12 @@
{
EdgeIndex v_row_start = g.m_rowstart[v];
EdgeIndex next_row_start = g.m_rowstart[v + 1];
+#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE
+ return next_row_start - v_row_start;
+#else
+ // Special case to allow incremental construction
return (std::max)(v_row_start, next_row_start) - v_row_start;
+#endif
}
// From AdjacencyGraph
@@ -964,9 +975,15 @@
{
EdgeIndex v_row_start = g.m_rowstart[v];
EdgeIndex next_row_start = g.m_rowstart[v + 1];
+#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE
+ return std::make_pair(g.m_column.begin() + v_row_start,
+ g.m_column.begin() + next_row_start);
+#else
+ // Special case to allow incremental construction
return std::make_pair(g.m_column.begin() + v_row_start,
g.m_column.begin() +
(std::max)(v_row_start, next_row_start));
+#endif
}
// Extra, common functions
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