Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56014 - in trunk: boost/graph libs/graph/doc
From: jewillco_at_[hidden]
Date: 2009-09-04 10:47:58


Author: jewillco
Date: 2009-09-04 10:47:57 EDT (Fri, 04 Sep 2009)
New Revision: 56014
URL: http://svn.boost.org/trac/boost/changeset/56014

Log:
Stopped requiring vertex() function for graphs being copied into CSR format
Text files modified:
   trunk/boost/graph/compressed_sparse_row_graph.hpp | 11 ++++++++---
   trunk/libs/graph/doc/compressed_sparse_row.html | 4 +---
   2 files changed, 9 insertions(+), 6 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-09-04 10:47:57 EDT (Fri, 04 Sep 2009)
@@ -26,6 +26,7 @@
 #include <boost/graph/properties.hpp>
 #include <boost/graph/filtered_graph.hpp> // For keep_all
 #include <boost/graph/detail/indexed_properties.hpp>
+#include <boost/graph/iteration_macros.hpp>
 #include <boost/iterator/counting_iterator.hpp>
 #include <boost/iterator/reverse_iterator.hpp>
 #include <boost/iterator/zip_iterator.hpp>
@@ -950,7 +951,7 @@
 #endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE
 
 
- // Requires IncidenceGraph, a vertex index map, and a vertex(n, g) function
+ // Requires IncidenceGraph and a vertex index map
   template<typename Graph, typename VertexIndexMap>
   compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi,
                               vertices_size_type numverts,
@@ -985,7 +986,7 @@
   }
 
   // From any graph (slow and uses a lot of memory)
- // Requires IncidenceGraph, a vertex index map, and a vertex(n, g) function
+ // Requires IncidenceGraph and a vertex index map
   // Internal helper function
   // Note that numedges must be doubled for undirected source graphs
   template<typename Graph, typename VertexIndexMap>
@@ -1002,9 +1003,13 @@
     typedef typename boost::graph_traits<Graph>::out_edge_iterator
       g_out_edge_iter;
 
+ std::vector<g_vertex> ordered_verts_of_g(numverts);
+ BGL_FORALL_VERTICES_T(v, g, Graph) {
+ ordered_verts_of_g[get(vertex_index, g, v)] = v;
+ }
     for (Vertex i = 0; i != numverts; ++i) {
       m_rowstart[i] = current_edge;
- g_vertex v = vertex(i, g);
+ g_vertex v = ordered_verts_of_g[i];
 #ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE
       // Out edges in a single vertex are only sorted for the old interface
       EdgeIndex num_edges_before_this_vertex = current_edge;

Modified: trunk/libs/graph/doc/compressed_sparse_row.html
==============================================================================
--- trunk/libs/graph/doc/compressed_sparse_row.html (original)
+++ trunk/libs/graph/doc/compressed_sparse_row.html 2009-09-04 10:47:57 EDT (Fri, 04 Sep 2009)
@@ -699,9 +699,7 @@
     <p class="indent">
       Clears the CSR graph and builds a CSR graph in place from the
       structure of another graph. The graph type <tt>Graph</tt> must
- be a model of IncidenceGraph
- and have a <tt>vertex(i, g)</tt> function that retrieves the
- <i>i</i><sup>th</sup> vertex in the graph.
+ be a model of IncidenceGraph.
 
       <br><b>Parameters</b>
 


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