Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2004-08-23 09:56:44


On Aug 20, 2004, at 3:53 PM, Jeff Holle wrote:

> I'm using gcc v3.4.1 and boost_CVS captured on Tue Jun 29 05:25:17 EDT
> 2004.
> I'm developing a boost.graph application that must deal with multiple
> graphs.
>
> The following typedefs describe how its using boost.graph:
> typedef
> boost::adjacency_list<boost::vecS,boost::vecS,boost::bidirectionalS>
> GraphT;
[snip]
> I've used ExternalVertex successfully in two different maps.

Since the vertices are stored in an std::vector, the vertex descriptor
is actually an unsigned integer in [0:num_vertices(g)).

> Now I'm having trouble populating the first map that uses ExternalEdge.
> The compiler warnings that I'm getting sugguest that Edge does have an
> "operator<" method. Specifically its:
> error: no match for 'operator<' in '__x->std::pair<GraphPtr,
> Edge>::second < __y->std::pair<GraphPtr, Edge>::second'

Right. Edge descriptors do not have a < operator.

> I'm wondering why Edge is different from Vertex.

It's not always clear how to order edges, nor is it clear how to order
vertices except when the vertices are stored in an std::vector.

> Any guidance that assists me to, at worst case, write a Compare
> operator for my "map<ExternalEdge,...>" containers would be
> appreciated.

You have a few options here:
        1) You could just add the property as an internal property
        2) You could add (and maintain!) an edge_index internal property and
order based on that
        3) If you don't have parallel edges, you could order based on
std::make_pair(source(e, g), target(e, g)).

        Doug


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