Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2005-06-22 11:08:40

On May 28, 2005, at 4:14 PM, Wang Johny wrote:
> I am a new user of boost (in particular BGL). For my project, I am
> using the function of "prim_minimum_spanning_tree" to construct the
> minimum spanning tree. But I found a strange problem and hope to get
> your help.
> Specifically, I am following the sample code "prim-example.cpp" (using
> MSVC), with one modification to the weight property. That is, I am
> defining the weight property as
> property < edge_weight_t, float >
> not the original one
> property < edge_weight_t, int >
> And I found by doing so, the function of "prim_minimum_spanning_tree"
> return wrong results (no edge is returned at all). But the original
> version using "property < edge_weight_t, int >" definition works well.
> So I am wondering if I missed something to make user-defined weitgh
> property work for this function.

That's really strange... I changed "int" to "float" and everything
works with GCC (I don't have MSVC to test with). You should also change
the "property<vertex_distance_t, int>" to "property<vertex_distance_t,
float>"; perhaps some strange truncation/conversion is happening.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at