|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77223 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2012-03-04 15:24:31
Author: jewillco
Date: 2012-03-04 15:24:30 EST (Sun, 04 Mar 2012)
New Revision: 77223
URL: http://svn.boost.org/trac/boost/changeset/77223
Log:
Applied patch from #6564; fixes #6564
Text files modified:
trunk/boost/graph/subgraph.hpp | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
Modified: trunk/boost/graph/subgraph.hpp
==============================================================================
--- trunk/boost/graph/subgraph.hpp (original)
+++ trunk/boost/graph/subgraph.hpp 2012-03-04 15:24:30 EST (Sun, 04 Mar 2012)
@@ -131,15 +131,29 @@
// copy constructor
subgraph(const subgraph& x)
- : m_graph(x.m_graph), m_parent(x.m_parent), m_edge_counter(x.m_edge_counter)
+ : m_parent(x.m_parent), m_edge_counter(x.m_edge_counter)
, m_global_vertex(x.m_global_vertex), m_global_edge(x.m_global_edge)
{
- // Do a deep copy (recursive).
- for(typename ChildrenList::const_iterator i = x.m_children.begin();
- i != x.m_children.end(); ++i)
+ if(x.is_root())
{
- m_children.push_back(new subgraph<Graph>( **i ));
+ m_graph = x.m_graph;
}
+ // Do a deep copy (recursive).
+ // Only the root graph is copied, the subgraphs contain
+ // only references to the global vertices they own.
+ subgraph<Graph>::children_iterator i,i_end;
+ boost::tie(i,i_end) = x.children();
+ for(; i != i_end; ++i)
+ {
+ subgraph<Graph> child = this->create_subgraph();
+ child = *i;
+ vertex_iterator vi,vi_end;
+ boost::tie(vi,vi_end) = vertices(*i);
+ for (;vi!=vi_end;++vi)
+ {
+ add_vertex(*vi,child);
+ }
+ }
}
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