lemon/bits/graph_extender.h
changeset 2389 df6a32249b46
parent 2384 805c5a2a36dd
child 2391 14a343be7a5a
equal deleted inserted replaced
28:b6f0bea5934f 29:dad6227d0650
   554 
   554 
   555     /// \brief Base node of the iterator
   555     /// \brief Base node of the iterator
   556     ///
   556     ///
   557     /// Returns the base node (ie. the source in this case) of the iterator
   557     /// Returns the base node (ie. the source in this case) of the iterator
   558     Node baseNode(const OutEdgeIt &e) const {
   558     Node baseNode(const OutEdgeIt &e) const {
   559       return Parent::source((Edge)e);
   559       return Parent::source(static_cast<const Edge&>(e));
   560     }
   560     }
   561     /// \brief Running node of the iterator
   561     /// \brief Running node of the iterator
   562     ///
   562     ///
   563     /// Returns the running node (ie. the target in this case) of the
   563     /// Returns the running node (ie. the target in this case) of the
   564     /// iterator
   564     /// iterator
   565     Node runningNode(const OutEdgeIt &e) const {
   565     Node runningNode(const OutEdgeIt &e) const {
   566       return Parent::target((Edge)e);
   566       return Parent::target(static_cast<const Edge&>(e));
   567     }
   567     }
   568 
   568 
   569     /// \brief Base node of the iterator
   569     /// \brief Base node of the iterator
   570     ///
   570     ///
   571     /// Returns the base node (ie. the target in this case) of the iterator
   571     /// Returns the base node (ie. the target in this case) of the iterator
   572     Node baseNode(const InEdgeIt &e) const {
   572     Node baseNode(const InEdgeIt &e) const {
   573       return Parent::target((Edge)e);
   573       return Parent::target(static_cast<const Edge&>(e));
   574     }
   574     }
   575     /// \brief Running node of the iterator
   575     /// \brief Running node of the iterator
   576     ///
   576     ///
   577     /// Returns the running node (ie. the source in this case) of the
   577     /// Returns the running node (ie. the source in this case) of the
   578     /// iterator
   578     /// iterator
   579     Node runningNode(const InEdgeIt &e) const {
   579     Node runningNode(const InEdgeIt &e) const {
   580       return Parent::source((Edge)e);
   580       return Parent::source(static_cast<const Edge&>(e));
   581     }
   581     }
   582 
   582 
   583     /// Base node of the iterator
   583     /// Base node of the iterator
   584     ///
   584     ///
   585     /// Returns the base node of the iterator
   585     /// Returns the base node of the iterator
   677     }
   677     }
   678 
   678 
   679     UEdge addEdge(const Node& from, const Node& to) {
   679     UEdge addEdge(const Node& from, const Node& to) {
   680       UEdge uedge = Parent::addEdge(from, to);
   680       UEdge uedge = Parent::addEdge(from, to);
   681       notifier(UEdge()).add(uedge);
   681       notifier(UEdge()).add(uedge);
   682       std::vector<Edge> edges;
   682       std::vector<Edge> ev;
   683       edges.push_back(Parent::direct(uedge, true));
   683       ev.push_back(Parent::direct(uedge, true));
   684       edges.push_back(Parent::direct(uedge, false));      
   684       ev.push_back(Parent::direct(uedge, false));      
   685       notifier(Edge()).add(edges);
   685       notifier(Edge()).add(ev);
   686       return uedge;
   686       return uedge;
   687     }
   687     }
   688     
   688     
   689     void clear() {
   689     void clear() {
   690       notifier(Edge()).clear();
   690       notifier(Edge()).clear();
   719       notifier(Node()).erase(node);
   719       notifier(Node()).erase(node);
   720       Parent::erase(node);
   720       Parent::erase(node);
   721     }
   721     }
   722 
   722 
   723     void erase(const UEdge& uedge) {
   723     void erase(const UEdge& uedge) {
   724       std::vector<Edge> edges;
   724       std::vector<Edge> ev;
   725       edges.push_back(Parent::direct(uedge, true));
   725       ev.push_back(Parent::direct(uedge, true));
   726       edges.push_back(Parent::direct(uedge, false));      
   726       ev.push_back(Parent::direct(uedge, false));      
   727       notifier(Edge()).erase(edges);
   727       notifier(Edge()).erase(ev);
   728       notifier(UEdge()).erase(uedge);
   728       notifier(UEdge()).erase(uedge);
   729       Parent::erase(uedge);
   729       Parent::erase(uedge);
   730     }
   730     }
   731 
   731 
   732     UGraphExtender() {
   732     UGraphExtender() {
  1005   
  1005   
  1006     /// \brief Base node of the iterator
  1006     /// \brief Base node of the iterator
  1007     ///
  1007     ///
  1008     /// Returns the base node (ie. the source in this case) of the iterator
  1008     /// Returns the base node (ie. the source in this case) of the iterator
  1009     Node baseNode(const OutEdgeIt &e) const {
  1009     Node baseNode(const OutEdgeIt &e) const {
  1010       return Parent::source((Edge&)e);
  1010       return Parent::source(static_cast<const Edge&>(e));
  1011     }
  1011     }
  1012     /// \brief Running node of the iterator
  1012     /// \brief Running node of the iterator
  1013     ///
  1013     ///
  1014     /// Returns the running node (ie. the target in this case) of the
  1014     /// Returns the running node (ie. the target in this case) of the
  1015     /// iterator
  1015     /// iterator
  1016     Node runningNode(const OutEdgeIt &e) const {
  1016     Node runningNode(const OutEdgeIt &e) const {
  1017       return Parent::target((Edge&)e);
  1017       return Parent::target(static_cast<const Edge&>(e));
  1018     }
  1018     }
  1019   
  1019   
  1020     /// \brief Base node of the iterator
  1020     /// \brief Base node of the iterator
  1021     ///
  1021     ///
  1022     /// Returns the base node (ie. the target in this case) of the iterator
  1022     /// Returns the base node (ie. the target in this case) of the iterator
  1023     Node baseNode(const InEdgeIt &e) const {
  1023     Node baseNode(const InEdgeIt &e) const {
  1024       return Parent::target((Edge&)e);
  1024       return Parent::target(static_cast<const Edge&>(e));
  1025     }
  1025     }
  1026     /// \brief Running node of the iterator
  1026     /// \brief Running node of the iterator
  1027     ///
  1027     ///
  1028     /// Returns the running node (ie. the source in this case) of the
  1028     /// Returns the running node (ie. the source in this case) of the
  1029     /// iterator
  1029     /// iterator
  1030     Node runningNode(const InEdgeIt &e) const {
  1030     Node runningNode(const InEdgeIt &e) const {
  1031       return Parent::source((Edge&)e);
  1031       return Parent::source(static_cast<const Edge&>(e));
  1032     }
  1032     }
  1033   
  1033   
  1034     class IncEdgeIt : public Parent::UEdge { 
  1034     class IncEdgeIt : public Parent::UEdge { 
  1035       friend class BpUGraphExtender;
  1035       friend class BpUGraphExtender;
  1036       const Graph* graph;
  1036       const Graph* graph;
  1293       notifier(BNode()).add(node);
  1293       notifier(BNode()).add(node);
  1294       notifier(Node()).add(node);
  1294       notifier(Node()).add(node);
  1295       return node;
  1295       return node;
  1296     }
  1296     }
  1297   
  1297   
  1298     UEdge addEdge(const Node& source, const Node& target) {
  1298     UEdge addEdge(const Node& s, const Node& t) {
  1299       UEdge uedge = Parent::addEdge(source, target);
  1299       UEdge uedge = Parent::addEdge(s, t);
  1300       notifier(UEdge()).add(uedge);
  1300       notifier(UEdge()).add(uedge);
  1301     
  1301     
  1302       std::vector<Edge> edges;
  1302       std::vector<Edge> ev;
  1303       edges.push_back(Parent::direct(uedge, true));
  1303       ev.push_back(Parent::direct(uedge, true));
  1304       edges.push_back(Parent::direct(uedge, false));
  1304       ev.push_back(Parent::direct(uedge, false));
  1305       notifier(Edge()).add(edges);
  1305       notifier(Edge()).add(ev);
  1306     
  1306     
  1307       return uedge;
  1307       return uedge;
  1308     }
  1308     }
  1309 
  1309 
  1310     void clear() {
  1310     void clear() {
  1349       notifier(Node()).erase(node);
  1349       notifier(Node()).erase(node);
  1350       Parent::erase(node);
  1350       Parent::erase(node);
  1351     }
  1351     }
  1352     
  1352     
  1353     void erase(const UEdge& uedge) {
  1353     void erase(const UEdge& uedge) {
  1354       std::vector<Edge> edges;
  1354       std::vector<Edge> ev;
  1355       edges.push_back(Parent::direct(uedge, true));
  1355       ev.push_back(Parent::direct(uedge, true));
  1356       edges.push_back(Parent::direct(uedge, false));
  1356       ev.push_back(Parent::direct(uedge, false));
  1357       notifier(Edge()).erase(edges);
  1357       notifier(Edge()).erase(ev);
  1358       notifier(UEdge()).erase(uedge);
  1358       notifier(UEdge()).erase(uedge);
  1359       Parent::erase(uedge);
  1359       Parent::erase(uedge);
  1360     }
  1360     }
  1361 
  1361 
  1362 
  1362