diff -r ef2d00e46897 -r c2992fd74dad lemon/bits/extendable_graph_extender.h --- a/lemon/bits/extendable_graph_extender.h Wed Feb 22 12:45:59 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -#ifndef LEMON_EXTENDABLE_GRAPH_EXTENDER_H -#define LEMON_EXTENDABLE_GRAPH_EXTENDER_H - -namespace lemon { - - template - class ExtendableGraphExtender : public _Base { - public: - - typedef ExtendableGraphExtender Graph; - typedef _Base Parent; - - typedef typename Parent::Node Node; - typedef typename Parent::Edge Edge; - - Node addNode() { - Node node = Parent::addNode(); - Parent::getNotifier(Node()).add(node); - return node; - } - - Edge addEdge(const Node& from, const Node& to) { - Edge edge = Parent::addEdge(from, to); - Parent::getNotifier(Edge()).add(edge); - return edge; - } - - }; - - template - class ExtendableEdgeSetExtender : public _Base { - public: - - typedef ExtendableEdgeSetExtender Graph; - typedef _Base Parent; - - typedef typename Parent::Edge Edge; - typedef typename Parent::Node Node; - - Edge addEdge(const Node& from, const Node& to) { - Edge edge = Parent::addEdge(from, to); - Parent::getNotifier(Edge()).add(edge); - return edge; - } - - }; - - template - class ExtendableUGraphExtender : public _Base { - public: - - typedef ExtendableUGraphExtender Graph; - typedef _Base Parent; - - typedef typename Parent::Node Node; - typedef typename Parent::Edge Edge; - typedef typename Parent::UEdge UEdge; - - Node addNode() { - Node node = Parent::addNode(); - Parent::getNotifier(Node()).add(node); - return node; - } - - UEdge addEdge(const Node& from, const Node& to) { - UEdge uedge = Parent::addEdge(from, to); - Parent::getNotifier(UEdge()).add(uedge); - - std::vector edges; - edges.push_back(Parent::direct(uedge, true)); - edges.push_back(Parent::direct(uedge, false)); - Parent::getNotifier(Edge()).add(edges); - - return uedge; - } - - }; - - template - class ExtendableUEdgeSetExtender : public _Base { - public: - - typedef ExtendableUEdgeSetExtender Graph; - typedef _Base Parent; - - typedef typename Parent::Node Node; - typedef typename Parent::Edge Edge; - typedef typename Parent::UEdge UEdge; - - UEdge addEdge(const Node& from, const Node& to) { - UEdge uedge = Parent::addEdge(from, to); - Parent::getNotifier(UEdge()).add(uedge); - - std::vector edges; - edges.push_back(Parent::direct(uedge, true)); - edges.push_back(Parent::direct(uedge, false)); - Parent::getNotifier(Edge()).add(edges); - - return uedge; - } - - }; - - - template - class ExtendableBpUGraphExtender : public _Base { - public: - - typedef _Base Parent; - typedef ExtendableBpUGraphExtender Graph; - - typedef typename Parent::Node Node; - typedef typename Parent::BNode BNode; - typedef typename Parent::ANode ANode; - typedef typename Parent::Edge Edge; - typedef typename Parent::UEdge UEdge; - - Node addANode() { - Node node = Parent::addANode(); - Parent::getNotifier(ANode()).add(node); - Parent::getNotifier(Node()).add(node); - return node; - } - - Node addBNode() { - Node node = Parent::addBNode(); - Parent::getNotifier(BNode()).add(node); - Parent::getNotifier(Node()).add(node); - return node; - } - - UEdge addEdge(const Node& source, const Node& target) { - UEdge uedge = Parent::addEdge(source, target); - Parent::getNotifier(UEdge()).add(uedge); - - std::vector edges; - edges.push_back(Parent::direct(uedge, true)); - edges.push_back(Parent::direct(uedge, false)); - Parent::getNotifier(Edge()).add(edges); - - return uedge; - } - - }; - -} - -#endif