Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50155 - sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list
From: asutton_at_[hidden]
Date: 2008-12-06 08:18:37


Author: asutton
Date: 2008-12-06 08:18:37 EST (Sat, 06 Dec 2008)
New Revision: 50155
URL: http://svn.boost.org/trac/boost/changeset/50155

Log:
Working on remove_edges(g,v).

Text files modified:
   sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/incidence_store.hpp | 15 +++++++++++++++
   sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/undirected_graph.hpp | 1 +
   2 files changed, 16 insertions(+), 0 deletions(-)

Modified: sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/incidence_store.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/incidence_store.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/incidence_store.hpp 2008-12-06 08:18:37 EST (Sat, 06 Dec 2008)
@@ -167,6 +167,21 @@
           Visitor vis = Visitor())
 { detail::dispatch_erase_all(store, v, vis, container_category(store)); }
 
+/**
+ * Remove all incident edges from the edge set, invoking a visitor just prior
+ * to erasing the edge.
+ */
+template <typename Store, typename Visitor = detail::noop_erase_visitor>
+inline void
+clear(Store& store, Visitor vis = Visitor())
+{
+ typename Store::iterator i, end = store.end();
+ for(i = store.begin() ; i != end; ++i) {
+ vis(*i);
+ }
+}
+
+
 /** Return the size of an adjacency list for the given vertex, its degree. */
 template <typename Store>
 inline typename incidence_store_traits<Store>::incident_edges_size_type

Modified: sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/undirected_graph.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/undirected_graph.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/undirected_graph.hpp 2008-12-06 08:18:37 EST (Sat, 06 Dec 2008)
@@ -282,6 +282,7 @@
 remove_edges(undirected_graph<VL,EL,VS,ES,IS>& g,
              typename undirected_graph<VL,EL,VS,ES,IS>::vertex_descriptor v)
 {
+ incs::clear(vs::edges(g.v, v));
 }
 
 /** Return the number of edges in the graph. */


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