|
Boost Users : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2003-11-14 14:44:52
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_at_[hidden]
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_at_[hidden]
C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net