Derive from adjacency_list

Hi all,
I want to derive a class from adjacency_list :
template <class NodesContainer = boost::vecS,
class EdgesContainer = boost::vecS,
class Directed = boost::undirectedS,
class NodesAttributes = boost::no_property,
class EdgesAttributes = boost::no_property
> class BGL_Graph : public boost::adjacency_list

OK, I found the solution :
for(boost::tie(first, last)=edges(*this);first!=last;++first)
instead of
for(boost::tie(first, last)=edges(this);first!=last;++first)
2007/11/9, Olivier Tournaire
Hi all,
I want to derive a class from adjacency_list :
template <class NodesContainer = boost::vecS, class EdgesContainer = boost::vecS, class Directed = boost::undirectedS, class NodesAttributes = boost::no_property, class EdgesAttributes = boost::no_property > class BGL_Graph : public boost::adjacency_list
{ /// ... many typedefs /// ... }; I also have an other derived class from BGL_Graph :
class MPPRectangleGraph : public BGL_Graphboost::vecS,boost::vecS,boost::undirectedS,MPPRectangleGraphNode,Weight
{ public: MPPRectangleGraph() {is_init_ = false;}; ~MPPRectangleGraph();
void InitDisplay(std::string name = "MPP", unsigned int width = 200, unsigned int height = 200); void Draw( unsigned int flags = DRAW_NOTHING); void Display( unsigned int flags = DRAW_NOTHING );
protected: private: bool is_init_; IdFenetreCalques window_; IdCalqueVecteur layer_rectangle_; IdCalqueVecteur layer_profiles_; IdCalqueVecteur layer_neighborhood_; IdCalqueVecteur layer_edges_; };
My problem is how can I iterate on the edges in a method of MPPRectangleGraph ?
void MPPRectangleGraph::Draw( unsigned int flags ) { // On recupere les differents flags d'affichage bool draw_rect = false, draw_profiles = false, draw_neighborhood = false, draw_edges = false; if ( flags&DRAW_RECTANGLE ) draw_rect = true; if ( flags&DRAW_PROFILES ) draw_profiles = true; if ( flags&DRAW_NEIGHBORHOOD ) draw_neighborhood = true; if ( flags&DRAW_EDGES ) draw_edges = true;
// On vide tous les calques layer_rectangle_.Clear(); layer_profiles_.Clear(); layer_neighborhood_.Clear(); layer_edges_.Clear();
// On fait l'affichage en fonction des flags recuperes // Les aretes MPPRectangleGraph::edge_iterator first, last; for(boost::tie(first, last)=edges(this);first!=last;++first) // does not work ! { //std::cout << boost::source(*first, g) << " to " << boost::target(*first, g) << " = "; } }
Regards
-- Le temps des cerises reviendra. Dans l'immédiat, c'est le temps des noyaux. Courage.
-- Le temps des cerises reviendra. Dans l'immédiat, c'est le temps des noyaux. Courage.
participants (1)
-
Olivier Tournaire