|
Boost Users : |
Subject: Re: [Boost-users] [BGL] What's the problem when the dijkstra_shortest_paths is used with stanford_graph
From: smallpang smallpang (smallpang_at_[hidden])
Date: 2010-05-24 03:18:29
Thank you for your reply.
1 The reason for the problem you suggest had been considered in the
file <boost/graph/stanford_graph.hpp>, such as
*namespace boost {
typedef Graph* sgb_graph_ptr;
typedef const Graph* sgb_const_graph_ptr;*
2 There are several reasons I don't using "const Graph*" as the type of the
graph object.
(1) I modify the code as below:
* const Graph* inputG;*
* char *in_filename = "r10-0.gb";*
more and more errors come up, I find that the graph object *inputG should be
modified in
the dijkstra_shortest_path algorithm.
(2) The Graph type point to the const graph object can point to the not
const graph such as
inputG (Graph *inputG).
(3) There are several code samples as I do, such as
*http://www.boost.org/doc/libs/1_40_0/libs/graph/example/miles_span.cpp*
*
http://www.boost.org/doc/libs/1_40_0/libs/graph/example/dijkstra-example.cpp
*
Additionaly, the oder of include files is likely the second one, such as:
*#include <boost/graph/dijkstra_shortest_paths.hpp>*
*#include <boost/graph/stanford_graph.hpp>*
I have no idea what's the reason for the problem.
On Sun, May 23, 2010 at 2:15 AM, Jeremiah Willcock <jewillco_at_[hidden]>
wrote:
>
> On Sat, 22 May 2010, smallpang smallpang wrote:
>
>> dear everyone
>>
>> I want to construct multicast tree base on the network topology generated
by the stanford graph.
>> The source code below can run without error, and have the right output:
>> The file is open!
>> m:28
>> n:10
>>
>> But when I add the algrithom dijkstra_shortest_paths.
>> The error messages show as below:
>> Description Resource Path Location Type
>> no matching function for call to num_vertices(Graph* const&)
MulticastTree2 line 190,
>> external location:
/usr/include/boost/graph/dijkstra_shortest_paths.hpp C/C++ Problem
>> Description Resource Path Location Type
>> no matching function for call to out_edges(Vertex*&, Graph* const&)
MulticastTree2 line 76,
>> external location: /usr/include/boost/graph/breadth_first_search.hpp
C/C++ Problem
>> Description Resource Path Location Type
>> no matching function for call to vertices(Graph* const&) MulticastTree2
line 375,
>> external location:
/usr/include/boost/graph/dijkstra_shortest_paths.hpp C/C++ Problem
>>
>> I find the num_vertices\out_edges\vertices are redefined in the
stanford_graph.hpp.
>> So I change the order of the include files as below:
>> #include <boost/graph/stanford_graph.hpp>
>> #include <boost/graph/dijkstra_shortest_paths.hpp>
>>
>> The errors above disappear, and New errors come up:
>> Description Resource Path Location Type
>> g was not declared in this scope MulticastTree2 line 408,
>> external location: /usr/include/boost/graph/named_function_params.hpp
C/C++ Problem
>> Description Resource Path Location Type
>> t was not declared in this scope MulticastTree2 line 408,
>> external location: /usr/include/boost/graph/named_function_params.hpp
C/C++ Problem
>> Description Resource Path Location Type
>> u was not declared in this scope MulticastTree2 line 463,
>> external location: /usr/include/boost/pending/relaxed_heap.hpp C/C++
Problem
>> Description Resource Path Location Type
>> expected , or ... before . token MulticastTree2 line 402,
>> external location: /usr/include/boost/graph/named_function_params.hpp
C/C++ Problem
>> Description Resource Path Location Type
>> expected initializer before . token MulticastTree2 line 462,
>> external location: /usr/include/boost/pending/relaxed_heap.hpp C/C++
Problem
>>
>> It's confusing for me, can you tell me what's the problem is
>> and any way i can try to solve the problems above.
>
> It looks like (for the second include order) that many places in BGL use
Graph as a template parameter name, so that is likely the problem there;
please use the first ordering. For the first one, that may be fixable by
using "const Graph*" as the type of your graph object (and changing the rest
of the Graph*'s to that as well). See if that changes any of the errors.
>
> -- Jeremiah Willcock
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
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