3 #include <boost/graph/adjacency_list.hpp> 4 #include <boost/graph/filtered_graph.hpp> 5 #include <boost/intrusive/set_hook.hpp> 6 #include <boost/intrusive/set.hpp> 7 #include <boost/any.hpp> 10 namespace bi = boost::intrusive;
13 struct VertexData : bi::set_base_hook<bi::link_mode<bi::auto_unlink>, bi::constant_time_size<false> > {
25 using by_label_idx_t = bi::set<VertexData, bi::constant_time_size<false>, bi::key_of_value<VertexData::by_label> >;
34 typedef boost::adjacency_list<boost::vecS, boost::vecS,
35 boost::bidirectionalS,
37 boost::property<boost::edge_weight_t, double, EdgeData> >
Graph;
40 using vertex_t = Graph::vertex_descriptor;
43 for (
auto label : {
"alerts",
"amazed",
"buster",
"deaths",
"ekes",
"Enoch",
"gale",
"hug",
"input",
"knifed",
"lire",
"man",
"pithy",
"Purims",
"Rodger",
"suckle",
"Terr",
"theme",
"tiling",
"vases", }) {
51 for (
auto vd : boost::make_iterator_range(boost::vertices(g)))
52 label_idx.insert(g[vd]);
56 std::cout <<
"Index: " << label_idx.size() <<
" elements\n";
59 std::cout <<
"Index: " << label_idx.size() <<
" elements\n";
61 for (
auto&
vertex : label_idx) {
const type & operator()(VertexData const &vd) const
VertexData(std::string label, int num)
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, VertexData, boost::property< boost::edge_weight_t, double, EdgeData > > Graph
define the boost-graph
bi::set< VertexData, bi::constant_time_size< false >, bi::key_of_value< VertexData::by_label > > by_label_idx_t