[BGL] Question on prim_minimum_spanning_tree
Hi, there
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.
Any suggestion is welcome. Thank you very much.
Best regards,
Shenai
Problematic code:
///////////////////////////////////////////////////////////////////////////////////////////////////
typedef adjacency_list < vecS, vecS, undirectedS, property
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
participants (2)
-
Doug Gregor
-
Wang Johny