Boost logo

Boost Users :

Subject: [Boost-users] BGL: How to get add_edge work with adjacency_list graph
From: Christoph (c_p_at_[hidden])
Date: 2011-09-26 06:05:42


Dear List,

i just started learning about The Boost Graph Library. Here is my
Problem in a minimal example:

#include <iostream>
#include <boost/graph/adjacency_list.hpp>
typedef boost::adjacency_list < boost::listS,
                                    boost::listS,
                                    boost::bidirectionalS>
    Map;

int main()
{
    Map map;
    std::cout << "number of vertices: "
                << num_vertices(map) << std::endl;
    Map::vertex_descriptor u = boost::add_vertex (map);;
    Map::vertex_descriptor v = boost::add_vertex (map);;
    std::cout << "number of vertices: "
                << num_vertices(map) << std::endl;
   
    Map::add_edge (u, v, map); // <- problem
    return 0;
}

The compiler tells me that ‘add_edge’ is not a member of ‘Map’. I would
like to know why and what am i doing wrong by writing
"Map::add_edge (u, v, map);"

best regards
Christoph


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