How Can I Know Which Boost Graph Properties are Available in a Template Adjacency List?

  adjacency-list, boost, boost-graph, c++, templates

Consider the following two adjacency lists:

#include <boost/graph/adjacency_list.hpp>

using Graph_1 = typename boost::adjacency_list<boost::vecS,
                 boost::vecS,
                 boost::directedS,
                 boost::no_property,
                 boost::property<boost::edge_weight_t, double> >;
Graph_1 graph_1(0);

struct VertexBundle { int some_int; };
struct EdgeBundle { double weight; };
struct GraphBundle { std::string name; };

using Graph_2 = typename boost::adjacency_list<boost::listS,
                 boost::listS,
                 boost::undirectedS,
                 VertexBundle,
                 boost::property<boost::edge_index_t, double, EdgeBundle>,
                 GraphBundle>;
Graph_2 graph_2(0);

They differ in their containers, directed category, and the properties defined for vertex, edge, and graph.

Now, for example with boost::detail::is_directed( boost::graph_traits<Graph>::directed_category ) I hold a boolean whether the graph of type Graph is directed or not, as taken from this SO question.

But how can I read out other information about the Graph Type’s properties, especially which internal/bundled properties the graph has defined?

I found this boost docs page on graph_traits, but I’m not quite getting the hang of it. To beginners, the boost graph docs are a bit hard to read…

I’m thankful about any hints!

Source: Windows Questions C++

LEAVE A COMMENT