lemon/bits/extendable_graph_extender.h
changeset 1837 8dd6160ff699
parent 1627 3fd1ba6e9872
child 1842 8abf74160dc4
equal deleted inserted replaced
1:b16f9682dc1d 2:6b95b36854e8
    58       return uedge;
    58       return uedge;
    59     }
    59     }
    60 
    60 
    61   };
    61   };
    62 
    62 
       
    63 
       
    64   template <typename _Base>
       
    65   class ExtendableUndirBipartiteGraphExtender : public _Base {
       
    66   public:
       
    67 
       
    68     typedef _Base Parent;
       
    69     typedef ExtendableUndirBipartiteGraphExtender Graph;
       
    70   
       
    71     typedef typename Parent::Node Node;
       
    72     typedef typename Parent::LowerNode LowerNode;
       
    73     typedef typename Parent::UpperNode UpperNode;
       
    74     typedef typename Parent::Edge Edge;
       
    75     typedef typename Parent::UndirEdge UndirEdge;
       
    76   
       
    77     Node addUpperNode() {
       
    78       Node node = Parent::addUpperNode();
       
    79       Parent::getNotifier(UpperNode()).add(node);
       
    80       Parent::getNotifier(Node()).add(node);
       
    81       return node;
       
    82     }
       
    83 
       
    84     Node addLowerNode() {
       
    85       Node node = Parent::addLowerNode();
       
    86       Parent::getNotifier(LowerNode()).add(node);
       
    87       Parent::getNotifier(Node()).add(node);
       
    88       return node;
       
    89     }
       
    90   
       
    91     UndirEdge addEdge(const Node& source, const Node& target) {
       
    92       UndirEdge undiredge = Parent::addEdge(source, target);
       
    93       Parent::getNotifier(UndirEdge()).add(undiredge);
       
    94     
       
    95       std::vector<Edge> edges;
       
    96       edges.push_back(Parent::direct(undiredge, true));
       
    97       edges.push_back(Parent::direct(undiredge, false));
       
    98       Parent::getNotifier(Edge()).add(edges);
       
    99     
       
   100       return undiredge;
       
   101     }
       
   102 
       
   103   };
       
   104 
    63 }
   105 }
    64 
   106 
    65 #endif
   107 #endif