Boost logo

Boost :

From: bta_at_[hidden]
Date: 2001-01-26 16:31:07


Thank you for the rapid reply Jeremy. I understand the problem now
given your clarification. I was able to remove the vertex_index_t
property from the adjacency_list template and get it to compile and
run with the expected output. However, it was also required to change
the EdgeList from a setS to vecS for compilation. This seems odd given
that I have yet to play with the edges at all. There does not seem to
be a requirement that the vertex and edge list use the same container
types (several examples use listS and vecS, respectively). The
following code fails to compile (error messages follow). It works fine
with the EdgeList set to a vecS container. Thanks again for the help.

                                                        B.T. Adams

#include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/property_map.hpp>

int main()
{
    // Set the graph characteristics
    typedef boost::adjacency_list<boost::vecS, boost::setS,
                boost::bidirectionalS> Graph;
    //typedef boost::adjacency_list<boost::vecS, boost::vecS,
    // boost::bidirectionalS> Graph;
    typedef Graph::vertex_iterator vertex_iterator;

    // Declare some graph variables.
    Graph graph1;

    const int nnodes = 4;

    boost::property_map<Graph, boost::vertex_index_t>::type v_index =
        get(boost::vertex_index, graph1);
    // Add a vertex corresponding to each input node.
    std::pair<vertex_iterator, vertex_iterator> vp;

    for (int n = 0; n < nnodes; n++)
        boost::add_vertex(graph1);

    std::cout << "vertices via add_vertex = ";
    for (vp = vertices(graph1); vp.first != vp.second; ++vp.first)
      std::cout << v_index[*vp.first] << " ";
    std::cout << std::endl;
    std::cout << std::endl;

     // Use a constructor with the number of vertices predefined.
    Graph graph2(nnodes);
    v_index = get(boost::vertex_index, graph2);

    std::cout << "vertices via constructor = ";
    for (vp = vertices(graph2); vp.first != vp.second; ++vp.first)
        std::cout << v_index[*vp.first] << " ";
    std::cout << std::endl;
    std::cout << std::endl;

    return 0;
}

"/home/bta/linux/include/boost/graph/detail/adjacency_list.hpp", line
2212: error:
          no instance of overloaded function
"boost::get_property_value"
          matches the argument list
            argument types are: (boost::no_property,
                     
boost::adj_list_vertex_property_map<boost::adjacency_list
                      <boost::vecS, boost::setS,
boost::bidirectionalS,
                      boost::no_property, boost::no_property,
                      boost::no_property>,
                     
boost::detail::vertex_property_map<boost::adjacency_list<
                      boost::vecS, boost::setS, boost::bidirectionalS,
                      boost::no_property, boost::no_property,
                      boost::no_property>,
boost::vertex_index_t>::Property,
                      boost::vertex_index_t>::value_type,
boost::vertex_index_t
                      )
          return get_property_value(sv->m_property, value_type(),
Tag());
                 ^
          detected during instantiation of
                    "boost::adj_list_vertex_property_map<Graph,
Property,
                    Tag>::value_type
                    &boost::adj_list_vertex_property_map<Graph,
Property,
                   
Tag>::operator[](boost::adj_list_vertex_property_map<Graph,
                    Property, Tag>::key_type) [with
                    Graph=boost::adjacency_list<boost::vecS,
boost::setS,
                    boost::bidirectionalS, boost::no_property,
                    boost::no_property, boost::no_property>,
                   
Property=boost::detail::vertex_property_map<boost::adjacenc
                    y_list<boost::vecS, boost::setS,
boost::bidirectionalS,
                    boost::no_property, boost::no_property,
                    boost::no_property>,
boost::vertex_index_t>::Property,
                    Tag=boost::vertex_index_t]" at line 29 of
                    "/home/bta/draco/src/graph/graph.cc"

"/home/bta/draco/src/graph/graph.cc", line 29: error: no operator "<<"
matches
          these operands
            operand types are: std::ostream <<
                     
boost::adj_list_vertex_property_map<boost::adjacency_list
                      <boost::vecS, boost::setS,
boost::bidirectionalS,
                      boost::no_property, boost::no_property,
                      boost::no_property>,
                     
boost::detail::vertex_property_map<boost::adjacency_list<
                      boost::vecS, boost::setS, boost::bidirectionalS,
                      boost::no_property, boost::no_property,
                      boost::no_property>,
boost::vertex_index_t>::Property,
                      boost::vertex_index_t>::value_type
        std::cout << v_index[*vp.first] << " ";

etc.......
                 
^


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk