diff -r 4cd528a30ec1 -r b6a68c15a6a3 lemon/list_ugraph.h --- a/lemon/list_ugraph.h Fri Jun 30 12:14:36 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +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_LIST_UGRAPH_H -#define LEMON_LIST_UGRAPH_H - -///\ingroup graphs -///\file -///\brief ListUGraph classes. - -#include -#include -#include - -#include -#include - -namespace lemon { - - typedef UGraphExtender > - ExtendedListUGraphBase; - - /// \ingroup graphs - - ///An undirected list graph class. - - ///This is a simple and fast erasable undirected graph implementation. - /// - ///It conforms to the - ///\ref concept::UGraph "UGraph" concept. - /// - ///\sa concept::UGraph. - /// - ///\todo Snapshot, reverseEdge(), changeTarget(), changeSource(), contract() - ///haven't been implemented yet. - /// - class ListUGraph : public ExtendedListUGraphBase { - public: - typedef ExtendedListUGraphBase Parent; - /// \brief Add a new node to the graph. - /// - /// \return the new node. - /// - Node addNode() { return Parent::addNode(); } - - /// \brief Add a new edge to the graph. - /// - /// Add a new edge to the graph with source node \c s - /// and target node \c t. - /// \return the new undirected edge. - UEdge addEdge(const Node& s, const Node& t) { - return Parent::addEdge(s, t); - } - /// \brief Changes the target of \c e to \c n - /// - /// Changes the target of \c e to \c n - /// - /// \note The Edge's and OutEdge's - /// referencing the changed edge remain - /// valid. However InEdge's are invalidated. - void changeTarget(UEdge e, Node n) { - Parent::changeTarget(e,n); - } - /// Changes the source of \c e to \c n - /// - /// Changes the source of \c e to \c n - /// - ///\note The Edge's and InEdge's - ///referencing the changed edge remain - ///valid. However OutEdge's are invalidated. - void changeSource(UEdge e, Node n) { - Parent::changeSource(e,n); - } - /// \brief Contract two nodes. - /// - /// This function contracts two nodes. - /// - /// Node \p b will be removed but instead of deleting - /// its neighboring edges, they will be joined to \p a. - /// The last parameter \p r controls whether to remove loops. \c true - /// means that loops will be removed. - /// - /// \note The Edges - /// referencing a moved edge remain - /// valid. - void contract(Node a, Node b, bool r = true) { - for(IncEdgeIt e(*this, b); e!=INVALID;) { - IncEdgeIt f = e; ++f; - if (r && runningNode(e) == a) { - erase(e); - } else if (source(e) == b) { - changeSource(e, a); - } else { - changeTarget(e, a); - } - e = f; - } - erase(b); - } - }; - -} //namespace lemon - - -#endif