lemon/bits/extendable_graph_extender.h
changeset 1842 8abf74160dc4
parent 1820 22099ef840d7
child 1909 2d806130e700
     1.1 --- a/lemon/bits/extendable_graph_extender.h	Wed Nov 30 17:49:01 2005 +0000
     1.2 +++ b/lemon/bits/extendable_graph_extender.h	Thu Dec 01 15:08:46 2005 +0000
     1.3 @@ -30,6 +30,24 @@
     1.4    };
     1.5  
     1.6    template <typename _Base> 
     1.7 +  class ExtendableEdgeSetExtender : public _Base {
     1.8 +  public:
     1.9 +
    1.10 +    typedef ExtendableEdgeSetExtender Graph;
    1.11 +    typedef _Base Parent;
    1.12 +
    1.13 +    typedef typename Parent::Edge Edge;
    1.14 +    typedef typename Parent::Node Node;
    1.15 +
    1.16 +    Edge addEdge(const Node& from, const Node& to) {
    1.17 +      Edge edge = Parent::addEdge(from, to);
    1.18 +      Parent::getNotifier(Edge()).add(edge);
    1.19 +      return edge;
    1.20 +    }
    1.21 +
    1.22 +  };
    1.23 +
    1.24 +  template <typename _Base> 
    1.25    class ExtendableUndirGraphExtender : public _Base {
    1.26    public:
    1.27  
    1.28 @@ -60,6 +78,31 @@
    1.29  
    1.30    };
    1.31  
    1.32 +  template <typename _Base> 
    1.33 +  class ExtendableUndirEdgeSetExtender : public _Base {
    1.34 +  public:
    1.35 +
    1.36 +    typedef ExtendableUndirEdgeSetExtender Graph;
    1.37 +    typedef _Base Parent;
    1.38 +
    1.39 +    typedef typename Parent::Node Node;
    1.40 +    typedef typename Parent::Edge Edge;
    1.41 +    typedef typename Parent::UndirEdge UndirEdge;
    1.42 +
    1.43 +    UndirEdge addEdge(const Node& from, const Node& to) {
    1.44 +      UndirEdge uedge = Parent::addEdge(from, to);
    1.45 +      Parent::getNotifier(UndirEdge()).add(uedge);
    1.46 +
    1.47 +      std::vector<Edge> edges;
    1.48 +      edges.push_back(Parent::direct(uedge, true));
    1.49 +      edges.push_back(Parent::direct(uedge, false));
    1.50 +      Parent::getNotifier(Edge()).add(edges);
    1.51 +
    1.52 +      return uedge;
    1.53 +    }
    1.54 +
    1.55 +  };
    1.56 +
    1.57  
    1.58    template <typename _Base>
    1.59    class ExtendableUndirBipartiteGraphExtender : public _Base {