lemon/bits/erasable_graph_extender.h
changeset 1938 c339ade3ffc3
parent 1842 8abf74160dc4
child 1956 a055123339d5
equal deleted inserted replaced
2:bca8ae6cc40d 3:4c4acb096845
    60     }
    60     }
    61 
    61 
    62   };
    62   };
    63 
    63 
    64   template <typename _Base> 
    64   template <typename _Base> 
    65   class ErasableUndirGraphExtender : public _Base {
    65   class ErasableUGraphExtender : public _Base {
    66   public:
    66   public:
    67 
    67 
    68     typedef ErasableUndirGraphExtender Graph;
    68     typedef ErasableUGraphExtender Graph;
    69     typedef _Base Parent;
    69     typedef _Base Parent;
    70 
    70 
    71     typedef typename Parent::Node Node;
    71     typedef typename Parent::Node Node;
    72     typedef typename Parent::UndirEdge UndirEdge;
    72     typedef typename Parent::UEdge UEdge;
    73     typedef typename Parent::Edge Edge;
    73     typedef typename Parent::Edge Edge;
    74 
    74 
    75     void erase(const Node& node) {
    75     void erase(const Node& node) {
    76       Edge edge;
    76       Edge edge;
    77       Parent::firstOut(edge, node);
    77       Parent::firstOut(edge, node);
    82 
    82 
    83       Parent::getNotifier(Node()).erase(node);
    83       Parent::getNotifier(Node()).erase(node);
    84       Parent::erase(node);
    84       Parent::erase(node);
    85     }
    85     }
    86     
    86     
    87     void erase(const UndirEdge& uedge) {
    87     void erase(const UEdge& uedge) {
    88       std::vector<Edge> edges;
    88       std::vector<Edge> edges;
    89       edges.push_back(Parent::direct(uedge,true));
    89       edges.push_back(Parent::direct(uedge,true));
    90       edges.push_back(Parent::direct(uedge,false));
    90       edges.push_back(Parent::direct(uedge,false));
    91       Parent::getNotifier(Edge()).erase(edges);
    91       Parent::getNotifier(Edge()).erase(edges);
    92       Parent::getNotifier(UndirEdge()).erase(uedge);
    92       Parent::getNotifier(UEdge()).erase(uedge);
    93       Parent::erase(uedge);
    93       Parent::erase(uedge);
    94     }
    94     }
    95 
    95 
    96   };
    96   };
    97 
    97 
    98   template <typename _Base> 
    98   template <typename _Base> 
    99   class ErasableUndirEdgeSetExtender : public _Base {
    99   class ErasableUEdgeSetExtender : public _Base {
   100   public:
   100   public:
   101 
   101 
   102     typedef ErasableUndirEdgeSetExtender Graph;
   102     typedef ErasableUEdgeSetExtender Graph;
   103     typedef _Base Parent;
   103     typedef _Base Parent;
   104 
   104 
   105     typedef typename Parent::Node Node;
   105     typedef typename Parent::Node Node;
   106     typedef typename Parent::UndirEdge UndirEdge;
   106     typedef typename Parent::UEdge UEdge;
   107     typedef typename Parent::Edge Edge;
   107     typedef typename Parent::Edge Edge;
   108 
   108 
   109     void erase(const UndirEdge& uedge) {
   109     void erase(const UEdge& uedge) {
   110       std::vector<Edge> edges;
   110       std::vector<Edge> edges;
   111       edges.push_back(Parent::direct(uedge,true));
   111       edges.push_back(Parent::direct(uedge,true));
   112       edges.push_back(Parent::direct(uedge,false));
   112       edges.push_back(Parent::direct(uedge,false));
   113       Parent::getNotifier(Edge()).erase(edges);
   113       Parent::getNotifier(Edge()).erase(edges);
   114       Parent::getNotifier(UndirEdge()).erase(uedge);
   114       Parent::getNotifier(UEdge()).erase(uedge);
   115       Parent::erase(uedge);
   115       Parent::erase(uedge);
   116     }
   116     }
   117 
   117 
   118   };
   118   };
   119 
   119