Boost logo

Boost Users :

Subject: [Boost-users] Boost graph library: brandes_betweenness_centrality() usage
From: Sebastian Rinke (rinke_at_[hidden])
Date: 2016-03-18 11:12:41


Dear all,

I have a question regarding how to use the BGL brandes_betweenness_centrality() function
for calculating the vertex betweenness centrality for a directed weighted graph.
Below is my small example that fails to compile:

—8>—

/* Create graph */
typedef property<edge_weight_t, double> EdgeWeightProperty;
typedef adjacency_list<
                         vecS, // OutEdgeList
                         vecS, // VertexList
                         directedS, // Directed
                         no_property, // VertexProperties
                         EdgeWeightProperty // EdgeProperties
> Graph;
  Graph graph(num_vertices);

/* Add edges … */
        
std::vector<double> v_centrality_vec(num_vertices(graph), 0.0);

// Create the external vertex centrality property map
iterator_property_map<std::vector<double>::iterator, identity_property_map>
  v_centrality_map(v_centrality_vec.begin());

brandes_betweenness_centrality(graph, v_centrality_map, weight_map(get(edge_weight, graph)));

—8>—

The first compilation error I get is:
boost_1_58_0/boost/graph/betweenness_centrality.hpp:248:7: error: no type named 'value_type' in 'struct boost::property_traits<boost::bgl_named_params<boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, boost::property<boost::edge_weight_t, double>, boost::edge_weight_t>, boost::edge_weight_t, boost::no_property> >'
       centrality_type;
       ^
When using the following call instead, it compiles:

brandes_betweenness_centrality(graph, v_centrality_map);

I would be very grateful for any help on this issue.

Best regards,
Sebastian


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