Hi all. Partway through my app's execution, I find that I no longer need the values in a custom property map (edge). The map potentially may be quite large. What is the best way to empty it? Thanks, -d
Also, what happens to a property map if I delete the edges/vertices in the graph that the map members point to? I am guessing I should erase() each member as well. Thanks for the help, -d David Ohlemacher wrote:
Hi all.
Partway through my app's execution, I find that I no longer need the values in a custom property map (edge). The map potentially may be quite large. What is the best way to empty it?
Thanks, -d
-- David Ohlemacher BBN Technologies 127 John Clarke Rd. Middletown, RI 02878 Phone: (401)848-3542, Fax:(401)849-8611 ohlemacher at bbn dot com
David Ohlemacher <ohlemacher@bbn.com> writes:
Hi all.
Partway through my app's execution, I find that I no longer need the values in a custom property map (edge). The map potentially may be quite large.
What is the best way to empty it?
It depends how the particular property map type is implemented. Deleting values is not part of the interface of property maps in general, and some property maps don't even support a way to do it (e.g. a built-in array of integers). -- Dave Abrahams Boost Consulting www.boost-consulting.com
I'm not sure what you mean by "custom". Are you using an internal property map (e.g., inside an adjacency_list) or are you using some external property map? On Thu, 13 Nov 2003, David Ohlemacher wrote: ohlema> Hi all. ohlema> ohlema> Partway through my app's execution, I find that I no longer need the ohlema> values in a custom property map (edge). The map potentially may be ohlema> quite large. ohlema> ohlema> What is the best way to empty it? ohlema> ohlema> Thanks, ohlema> -d ohlema> ohlema> _______________________________________________ ohlema> Boost-users mailing list ohlema> Boost-users@lists.boost.org ohlema> http://lists.boost.org/mailman/listinfo.cgi/boost-users ohlema> ---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 855-3608 ----------------------------------------------------------------------
Hi Jeremy, Internal. Here is my implementation. It is right out of your (very helpful) book. -d namespace boost { // ECInGraph custom properties. enum vertex_com_t {vertex_com = 1223497}; enum edge_nEmailsIn_t {edge_nEmailsIn = 1223498}; enum edge_nEmailsOut_t {edge_nEmailsOut = 1223499}; enum edge_sourceVD_t {edge_sourceVD = 1223500}; BOOST_INSTALL_PROPERTY (vertex, com); BOOST_INSTALL_PROPERTY (edge, nEmailsIn); BOOST_INSTALL_PROPERTY (edge, nEmailsOut); BOOST_INSTALL_PROPERTY (edge, sourceVD); } typedef boost::property <boost::edge_nEmailsOut_t, int, boost::property <boost::edge_nEmailsIn_t, int, boost::property <boost::edge_sourceVD_t, unsigned int> > > InGraphEdgeProps; typedef boost::property <boost::vertex_name_t, std::string, boost::property <boost::vertex_com_t, int> > InGraphVertexProps; typedef boost::adjacency_list < boost::vecS, // Edge list is a std::vector boost::vecS, // Vertex list is a std::vector boost::undirectedS, // undirected graph InGraphVertexProps, // Vertex properties InGraphEdgeProps, // Edge properties boost::no_property // Graph properties > ECInGraph; void EC::InitGraphPropertyMaps() { // m_inGraph property maps. m_g2VName = boost::get(boost::vertex_name, m_inGraph); m_g2Com = boost::get(boost::vertex_com, m_inGraph); m_g2EmailsIn = boost::get(boost::edge_nEmailsIn, m_inGraph); m_g2EmailsOut = boost::get(boost::edge_nEmailsOut, m_inGraph); m_g2SourceVD = boost::get(boost::edge_sourceVD, m_inGraph); } Jeremy Siek wrote:
I'm not sure what you mean by "custom". Are you using an internal property map (e.g., inside an adjacency_list) or are you using some external property map?
On Thu, 13 Nov 2003, David Ohlemacher wrote:
ohlema> Hi all. ohlema> ohlema> Partway through my app's execution, I find that I no longer need the ohlema> values in a custom property map (edge). The map potentially may be ohlema> quite large. ohlema> ohlema> What is the best way to empty it? ohlema> ohlema> Thanks, ohlema> -d ohlema> ohlema> _______________________________________________ ohlema> Boost-users mailing list ohlema> Boost-users@lists.boost.org ohlema> http://lists.boost.org/mailman/listinfo.cgi/boost-users ohlema>
---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 855-3608 ----------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- David Ohlemacher BBN Technologies 127 John Clarke Rd. Middletown, RI 02878 Phone: (401)848-3542, Fax:(401)849-8611 ohlemacher at bbn dot com
Hi all. Partway through my app's execution, I find that I no longer need the values in a custom internal property map (edge). The map potentially may be quite large. What is the best way to empty it? Thanks, -d
Here is my implementation. It is right out of your (very helpful) book.
-d
namespace boost { // ECInGraph custom properties. enum vertex_com_t {vertex_com = 1223497}; enum edge_nEmailsIn_t {edge_nEmailsIn = 1223498}; enum edge_nEmailsOut_t {edge_nEmailsOut = 1223499}; enum edge_sourceVD_t {edge_sourceVD = 1223500}; BOOST_INSTALL_PROPERTY (vertex, com); BOOST_INSTALL_PROPERTY (edge, nEmailsIn); BOOST_INSTALL_PROPERTY (edge, nEmailsOut); BOOST_INSTALL_PROPERTY (edge, sourceVD); }
typedef boost::property <boost::edge_nEmailsOut_t, int, boost::property <boost::edge_nEmailsIn_t, int, boost::property <boost::edge_sourceVD_t, unsigned int> > > InGraphEdgeProps; typedef boost::property <boost::vertex_name_t, std::string, boost::property <boost::vertex_com_t, int> > InGraphVertexProps;
typedef boost::adjacency_list < boost::vecS, // Edge list is a std::vector boost::vecS, // Vertex list is a std::vector boost::undirectedS, // undirected graph InGraphVertexProps, // Vertex properties InGraphEdgeProps, // Edge properties boost::no_property // Graph properties
ECInGraph;
void EC::InitGraphPropertyMaps() { // m_inGraph property maps. m_g2VName = boost::get(boost::vertex_name, m_inGraph); m_g2Com = boost::get(boost::vertex_com, m_inGraph); m_g2EmailsIn = boost::get(boost::edge_nEmailsIn, m_inGraph); m_g2EmailsOut = boost::get(boost::edge_nEmailsOut, m_inGraph); m_g2SourceVD = boost::get(boost::edge_sourceVD, m_inGraph); }
David Ohlemacher <ohlemacher@bbn.com> writes:
Hi all. Partway through my app's execution, I find that I no longer need the values in a custom internal property map (edge). The map potentially may be quite large.
What is the best way to empty it?
Jeremy and I both answered this question already. Was something wrong with the answers you received? -- Dave Abrahams Boost Consulting www.boost-consulting.com
Hi David, You can not empty (reclaim the space) for internal properties (without removing the edges or vertices). Instead I would recommend using external properties... this is in fact the primary reason that the BGL supports external properties. See the example exterior_properties.cpp Cheers, Jeremy On Fri, 14 Nov 2003, David Ohlemacher wrote: ohlema> Hi all. ohlema> ohlema> Partway through my app's execution, I find that I no longer need the ohlema> values in a custom internal property map (edge). The map potentially ohlema> may be quite large. ohlema> ohlema> What is the best way to empty it? ohlema> ohlema> Thanks, ohlema> -d ohlema> ohlema> > Here is my implementation. It is right out of your (very helpful) book. ohlema> > ohlema> > -d ohlema> > ohlema> > namespace boost ohlema> > { ohlema> > // ECInGraph custom properties. ohlema> > enum vertex_com_t {vertex_com = 1223497}; ohlema> > enum edge_nEmailsIn_t {edge_nEmailsIn = 1223498}; ohlema> > enum edge_nEmailsOut_t {edge_nEmailsOut = 1223499}; ohlema> > enum edge_sourceVD_t {edge_sourceVD = 1223500}; ohlema> > BOOST_INSTALL_PROPERTY (vertex, com); ohlema> > BOOST_INSTALL_PROPERTY (edge, nEmailsIn); ohlema> > BOOST_INSTALL_PROPERTY (edge, nEmailsOut); ohlema> > BOOST_INSTALL_PROPERTY (edge, sourceVD); ohlema> > } ohlema> > ohlema> > ohlema> > typedef boost::property <boost::edge_nEmailsOut_t, int, ohlema> > boost::property <boost::edge_nEmailsIn_t, int, ohlema> > boost::property <boost::edge_sourceVD_t, unsigned int> > > ohlema> > InGraphEdgeProps; ohlema> > typedef boost::property <boost::vertex_name_t, std::string, ohlema> > boost::property <boost::vertex_com_t, int> > ohlema> > InGraphVertexProps; ohlema> > ohlema> > typedef boost::adjacency_list < ohlema> > boost::vecS, // Edge list is a std::vector ohlema> > boost::vecS, // Vertex list is a std::vector ohlema> > boost::undirectedS, // undirected graph ohlema> > InGraphVertexProps, // Vertex properties ohlema> > InGraphEdgeProps, // Edge properties ohlema> > boost::no_property // Graph properties ohlema> > > ECInGraph; ohlema> > ohlema> > ohlema> > void EC::InitGraphPropertyMaps() ohlema> > { ohlema> > // m_inGraph property maps. ohlema> > m_g2VName = boost::get(boost::vertex_name, m_inGraph); ohlema> > m_g2Com = boost::get(boost::vertex_com, m_inGraph); ohlema> > m_g2EmailsIn = boost::get(boost::edge_nEmailsIn, m_inGraph); ohlema> > m_g2EmailsOut = boost::get(boost::edge_nEmailsOut, m_inGraph); ohlema> > m_g2SourceVD = boost::get(boost::edge_sourceVD, m_inGraph); ohlema> > } ohlema> > ohlema> ohlema> ohlema> _______________________________________________ ohlema> Boost-users mailing list ohlema> Boost-users@lists.boost.org ohlema> http://lists.boost.org/mailman/listinfo.cgi/boost-users ohlema> ---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 855-3608 ----------------------------------------------------------------------
participants (3)
-
David Abrahams
-
David Ohlemacher
-
Jeremy Siek