Boost logo

Boost Users :

Subject: Re: [Boost-users] [graph] problem with weight_map ? (brandes_betweenness_centrality)
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2013-03-20 13:46:24


On Wed, 20 Mar 2013, The Maschine wrote:

> Hi,
>
> ##
>
> > EdgeWeightProperty weight = getWeight(a, b); // 0f ... 2.0f
>
> Can you just assign a double to a boost::property<...> object? That
> should probably not be allowed.
> ##
>
> I found the example here and made my code:
>
> http://programmingexamples.net/wiki/CPP/Boost/BGL/DijkstraUndirected
>
> ###
>
> What happens if you write an explicit loop over all of the edges and use
> put(edge_weight, g, e) directly? Does that change any of the results?
>
> -- Jeremiah Willcock
>
> ###
>
> In not sure what you mean? Im not a super expert, can you please explain your thought more?

Instead of putting your weights in the add_edge calls, try using add_edge
without a weight then writing a loop such as:

BGL_FORALL_EDGES(e, g, graph_type) {
   put(edge_weight, g, e, weight);
}

to initialize the weights. BGL_FORALL_EDGES is from
<boost/graph/iteration_macros.hpp>.

-- Jeremiah Willcock


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