typedef boost::property<boost::edge_weight_t, double> EdgeWeightProperty;
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, VertexProperties, EdgeWeightProperty> unGraph;
EdgeWeightProperty weight = getWeight(a, b); // 0f ... 2.0f
std::pair<unGraph::edge_descriptor, bool> e = boost::add_edge(a, b, weight, m_ugraph);
boost::brandes_betweenness_centrality(m_ugraph , boost::centrality_map(boost::make_iterator_property_map(v_centrality_vec.begin(),boost::get(boost::vertex_index, m_ugraph),double())).vertex_index_map(get(boost::vertex_index, m_ugraph)).weight_map(get(boost::edge_weight, m_ugraph)) );
Hi all,I think I've got a problem with the way I use the weight property map in my betweenness_centrality (and maybe other locations too).I've got a graph like that:
typedef boost::property<boost::edge_weight_t, double> EdgeWeightProperty;
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, VertexProperties, EdgeWeightProperty> unGraph;
And I add edges with weights like that (simplified):
EdgeWeightProperty weight = getWeight(a, b); // 0f ... 2.0f
std::pair<unGraph::edge_descriptor, bool> e = boost::add_edge(a, b, weight, m_ugraph);
Than I try to do the brandes_centrality_betweenness:std::vector< double > v_centrality_vec(boost::num_vertices(m_ugraph), 0.0);
boost::brandes_betweenness_centrality(m_ugraph , boost::centrality_map(boost::make_iterator_property_map(v_centrality_vec.begin(),boost::get(boost::vertex_index, m_ugraph),double())).vertex_index_map(get(boost::vertex_index, m_ugraph)).weight_map(get(boost::edge_weight, m_ugraph)) );
But I get crazy results...1) I have checked by hand that my "getWeight" (my weights) are OK.2) I have set _ALL_ weights to 1.0 (almost as if brandes was using BFS internally), Again I get the _SAME_ crazy results!So there is something wrong with the way Im using the weight_map.What am I missing??
Best,Tasos