Boost logo

Boost Users :

From: Tony Cook (tony__cook_at_[hidden])
Date: 2005-09-21 10:40:34


You have to do something like this - but this doesn't support multigraphs

      template<typename EdgeType>
      struct EdgeCompare : public std::binary_function<EdgeType, EdgeType,
bool>
      {
         bool operator ()(const EdgeType& edge1, const EdgeType& edge2)
const
         {
            if (edge1.m_source < edge2.m_source) return true ;
            if (edge1.m_source == edge2.m_source &&
                edge1.m_target < edge2.m_target) return true ;
            return false ;
         }
      } ;
      
      typedef graph_traits<G>::edge_descriptor MyEdgeType
      typedef std::set<MyEdgeType, EdgeCompare<MyEdgeType> > MyEdgeSetType ;

TC

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Giulio Veronesi
Sent: 21 September 2005 13:18
To: boost-users_at_[hidden]
Subject: [Boost-users] BGL - edge descriptor and map

I'd like to specify better my problem. I'd like to use an
edge_descriptor (graph_traits<G>::edge_descriptor) as key in a map. The
graph type is something like this:

typedef adjacency_list<vecS, vecS, bidirectionalS,
          no_property, MyStuff> G;

I think that I've to overload the < operator for
graph_traits<G>::edge_descriptor. Is this correct? If so, given two
edge_descriptors I need to access the source and the target of the edge
in such a way to define a sort ordering.

Thanks,
Giulio

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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