Classes | Typedefs | Functions
test_bigraph.cxx File Reference
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/filtered_graph.hpp>
#include <boost/intrusive/set_hook.hpp>
#include <boost/intrusive/set.hpp>
#include <boost/any.hpp>
#include <iostream>

Go to the source code of this file.

Classes

struct  VertexData
 vertex properties More...
 
struct  VertexData::by_label
 
struct  EdgeData
 edges properties More...
 

Typedefs

using by_label_idx_t = bi::set< VertexData, bi::constant_time_size< false >, bi::key_of_value< VertexData::by_label > >
 
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, VertexData, boost::property< boost::edge_weight_t, double, EdgeData > > Graph
 define the boost-graph More...
 

Functions

int main ()
 

Typedef Documentation

using by_label_idx_t = bi::set<VertexData, bi::constant_time_size<false>, bi::key_of_value<VertexData::by_label> >

Definition at line 25 of file test_bigraph.cxx.

typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, VertexData, boost::property<boost::edge_weight_t, double, EdgeData> > Graph

define the boost-graph

Definition at line 37 of file test_bigraph.cxx.

Function Documentation

int main ( void  )

define vertexMap

Definition at line 39 of file test_bigraph.cxx.

39  {
40  using vertex_t = Graph::vertex_descriptor;
41 
42  Graph g;
43  for (auto label : { "alerts", "amazed", "buster", "deaths", "ekes", "Enoch", "gale", "hug", "input", "knifed", "lire", "man", "pithy", "Purims", "Rodger", "suckle", "Terr", "theme", "tiling", "vases", }) {
44  boost::add_vertex(VertexData{label, 1+rand()%5}, g);
45  }
46 
47  /// define vertexMap
48  by_label_idx_t label_idx;
49  auto reindex = [&] {
50  label_idx.clear();
51  for (auto vd : boost::make_iterator_range(boost::vertices(g)))
52  label_idx.insert(g[vd]);
53  };
54 
55  reindex();
56  std::cout << "Index: " << label_idx.size() << " elements\n";
57 
58  g.clear();
59  std::cout << "Index: " << label_idx.size() << " elements\n";
60 
61  for (auto& vertex : label_idx) {
62  std::cout << vertex.label << " " << vertex.num << "\n";
63  }
64 }
static const double g
Definition: Units.h:145
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
vertex properties
vertex reconstruction