[BGL] What's the problem when the dijkstra_shortest_paths is used with stanford_graph
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. Thank you. source code: *#include <boost/config.hpp> #include <iostream> #include <string> #include <fstream> #include <boost/graph/graph_traits.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/dijkstra_shortest_paths.hpp> #include <boost/graph/stanford_graph.hpp> using namespace boost; int main(int argc, char *argv[]) { Graph* inputG; char *in_filename = "r10-0.gb"; inputG = restore_graph(in_filename); if (inputG){ std::cout << "The file is open!" << "\n"; std::cout << "m:" << inputG->m << "\n"; std::cout << "n:" << inputG->n << "\n"; } else return 0; graph_traits<Graph*>::vertex_descriptor s = *boost::vertices(inputG).first; typedef property_map<Graph*, z_property<long> >::type Distance; Distance d = get(z_property<long>(), inputG); typedef property_map<Graph*, w_property<Vertex*> >::type Parent; Parent p = get(w_property<Vertex*>(), inputG); // dijkstra_shortest_paths(inputG, s, // predecessor_map(get(w_property<Vertex*>(), inputG)). // distance_map(get(z_property<long>(), inputG)). // weight_map(get(edge_length_t(), inputG)) // ); gb_recycle(inputG); return 1; }*
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
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@osl.iu.edu> wrote:
On Sat, 22 May 2010, smallpang smallpang wrote:
dear everyone
I want to construct multicast tree base on the network topology generated
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
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;
by the stanford graph. line 375, 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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Jeremiah Willcock
-
smallpang smallpang