Boost logo

Boost Users :

Subject: [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-22 00:20:29


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;
}*



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