Boost logo

Boost Users :

From: Irek Szczesniak (ijs_at_[hidden])
Date: 2006-04-14 17:03:55


I resolved the problem. I should have declared the graphs as:

typedef boost::adjacency_list<vecS, vecS, undirectedS,
        property<vertex_name_t, std::string>,
        property<edge_weight_t, double,
                property<edge_lambdas_t, int> >,
        no_property > Graph;

Sorry for the confusion.

Best,
Irek

Irek Szczesniak wrote:

> I want to use the read_graphiz function to load graphviz files. Graph
> links have an extra property called "lambdas," which tells about the
> number of wavelengths a link has. This link attribute is a positive
> integer.
>
> Below I'm sending you the program which I thought should work, but it
> doesn't. Plus, there is a sample graphviz file. I have hard time
> trying to decipher the errors, and made little progress, and so I
> would appreciate any advice. I'm attaching the compilation errors.
>
> Thanks for reading.
>
>
> Thanks & best,
> Irek
>
>
> *********************************************************************
>
> #include <fstream>
> #include <string>
>
> #include <boost/graph/adjacency_list.hpp>
> #include <boost/graph/graphviz.hpp>
> #include <boost/graph/depth_first_search.hpp>
> #include <boost/graph/iteration_macros.hpp>
>
> using namespace boost;
>
> enum edge_lambdas_t { edge_lambdas };
>
> namespace boost
> {
> BOOST_INSTALL_PROPERTY(edge, lambdas);
> }
>
> typedef boost::adjacency_list<vecS, vecS, undirectedS,
> property<vertex_name_t, std::string>,
> property<edge_weight_t, double>,
> property<edge_lambdas_t, int> > Graph;
>
> int
> main()
> {
> Graph g;
> dynamic_properties dp;
>
> dp.property("lambdas", get(edge_lambdas, g));
> dp.property("node_id", get(vertex_name, g));
> dp.property("distance", get(edge_weight, g));
>
> read_graphviz(std::cin, g, dp);
> }
>
> ***********************************************************************
>
> graph {
> a;
> b;
> c;
> c -- a [distance="100", lambdas="4"];
> a -- b [distance="200", lambdas="4"];
> }
>
> ***********************************************************************
>
> g++ -I /usr/local/include/boost-1_33_1/ -l bgl-viz load.cc -o load
> /usr/local/include/boost-1_33_1/boost/dynamic_property_map.hpp: In
> member function `std::string
> boost::detail::dynamic_property_map_adaptor<PropertyMap>::get_string(const
> (...)


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