src/work/list_graph.h
changeset 209 9a37b8d02d74
parent 174 44700ed9ffaa
child 212 c07e4dd32438
equal deleted inserted replaced
0:477e542ceef9 1:dd22d9c50150
   426     
   426     
   427     class EdgeIt : public Edge {
   427     class EdgeIt : public Edge {
   428       friend class ListGraph;
   428       friend class ListGraph;
   429       //protected: 
   429       //protected: 
   430     public: //for alpar
   430     public: //for alpar
   431       EdgeIt(const ListGraph& G) {
   431       EdgeIt(const ListGraph&) {
   432 	node_item* v=G._first_node;
   432 	node_item* v=G._first_node;
   433 	if (v) edge=v->_first_out_edge; else edge=0;
   433 	if (v) edge=v->_first_out_edge; else edge=0;
   434 	while (v && !edge) { v=v->_next_node; if (v) edge=v->_first_out_edge; }
   434 	while (v && !edge) { v=v->_next_node; if (v) edge=v->_first_out_edge; }
   435       }
   435       }
   436     public:
   436     public:
   453     protected: //for alpar
   453     protected: //for alpar
   454       OutEdgeIt(const Node& _v) /*: v(_v.node)*/ { edge=_v.node->_first_out_edge; }
   454       OutEdgeIt(const Node& _v) /*: v(_v.node)*/ { edge=_v.node->_first_out_edge; }
   455     public:
   455     public:
   456       OutEdgeIt() : Edge()/*, v(0)*/ { }
   456       OutEdgeIt() : Edge()/*, v(0)*/ { }
   457       OutEdgeIt(const Invalid& i) : Edge(i) { }
   457       OutEdgeIt(const Invalid& i) : Edge(i) { }
   458       OutEdgeIt(const ListGraph& G, Node _v) /*: v(_v.node)*/ { edge=_v.node->_first_out_edge; }
   458       OutEdgeIt(const ListGraph&, Node _v) /*: v(_v.node)*/ { edge=_v.node->_first_out_edge; }
   459     protected:
   459     protected:
   460       OutEdgeIt& operator++() { edge=edge->_next_out; return *this; }
   460       OutEdgeIt& operator++() { edge=edge->_next_out; return *this; }
   461     protected:
   461     protected:
   462       Node aNode() const { return Node(edge->_tail); }
   462       Node aNode() const { return Node(edge->_tail); }
   463       Node bNode() const { return Node(edge->_head); }
   463       Node bNode() const { return Node(edge->_head); }
   470     protected: //for alpar
   470     protected: //for alpar
   471       InEdgeIt(const Node& _v) /*: v(_v.node)*/ { edge=_v.node->_first_in_edge; }
   471       InEdgeIt(const Node& _v) /*: v(_v.node)*/ { edge=_v.node->_first_in_edge; }
   472     public:
   472     public:
   473       InEdgeIt() : Edge()/*, v(0)*/ { }
   473       InEdgeIt() : Edge()/*, v(0)*/ { }
   474       InEdgeIt(const Invalid& i) : Edge(i) { }
   474       InEdgeIt(const Invalid& i) : Edge(i) { }
   475       InEdgeIt(const ListGraph& G, Node _v) /*: v(_v.node)*/ { edge=_v.node->_first_in_edge; }
   475       InEdgeIt(const ListGraph&, Node _v) /*: v(_v.node)*/ { edge=_v.node->_first_in_edge; }
   476     protected:
   476     protected:
   477       InEdgeIt& operator++() { edge=edge->_next_in; return *this; }
   477       InEdgeIt& operator++() { edge=edge->_next_in; return *this; }
   478     protected:
   478     protected:
   479       Node aNode() const { return Node(edge->_head); }
   479       Node aNode() const { return Node(edge->_head); }
   480       Node bNode() const { return Node(edge->_tail); }
   480       Node bNode() const { return Node(edge->_tail); }
   492 	if (!edge) { edge=_v.node->_first_in_edge; out_or_in=0; }
   492 	if (!edge) { edge=_v.node->_first_in_edge; out_or_in=0; }
   493       }
   493       }
   494     public:
   494     public:
   495       SymEdgeIt() : Edge() /*, v(0)*/ { }
   495       SymEdgeIt() : Edge() /*, v(0)*/ { }
   496       SymEdgeIt(const Invalid& i) : Edge(i) { }
   496       SymEdgeIt(const Invalid& i) : Edge(i) { }
   497       SymEdgeIt(const ListGraph& G, Node _v) /*: v(_v.node)*/ { 
   497       SymEdgeIt(const ListGraph&, Node _v) /*: v(_v.node)*/ { 
   498 	out_or_in=1;
   498 	out_or_in=1;
   499 	edge=_v.node->_first_out_edge; 
   499 	edge=_v.node->_first_out_edge; 
   500 	if (!edge) { edge=_v.node->_first_in_edge; out_or_in=0; }
   500 	if (!edge) { edge=_v.node->_first_in_edge; out_or_in=0; }
   501       }
   501       }
   502     protected:
   502     protected: