//(整理by RobinKin from DevonIT)
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/breadth_first_search.hpp>
#include <boost/pending/indirect_cmp.hpp>
#include <boost/pending/integer_range.hpp>
#include <iostream>
using namespace boost;
template < typename TimeMap > class bfs_time_visitor:public default_bfs_visitor {
typedef typename property_traits < TimeMap >::value_type T;
public:
bfs_time_visitor(TimeMap tmap, T & t):m_timemap(tmap), m_time(t) { }
template < typename Vertex, typename Graph >
void discover_vertex(Vertex u, const Graph & g) const
{
put(m_timemap, u, m_time++);//每次访问 m_time加1
}
TimeMap m_timemap;
T & m_time;
};
int
main()
{
using namespace boost;
//
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/breadth_first_search.hpp>
#include <boost/pending/indirect_cmp.hpp>
#include <boost/pending/integer_range.hpp>
#include <iostream>
using namespace boost;
template < typename TimeMap > class bfs_time_visitor:public default_bfs_visitor {
typedef typename property_traits < TimeMap >::value_type T;
public:
bfs_time_visitor(TimeMap tmap, T & t):m_timemap(tmap), m_time(t) { }
template < typename Vertex, typename Graph >
void discover_vertex(Vertex u, const Graph & g) const
{
put(m_timemap, u, m_time++);//每次访问 m_time加1
}
TimeMap m_timemap;
T & m_time;
};
int
main()
{
using namespace boost;
//