# HG changeset patch # User deba # Date 1138292680 0 # Node ID f95eea8c34b071a82b16e504489f7955925f69cd # Parent 2d806130e7008e9cfba7e7e6f05e645214529b6d Bipartite => Bp Upper => A Lower => B + some bug fix diff -r 2d806130e700 -r f95eea8c34b0 demo/topology_demo.cc --- a/demo/topology_demo.cc Thu Jan 26 15:42:13 2006 +0000 +++ b/demo/topology_demo.cc Thu Jan 26 16:24:40 2006 +0000 @@ -59,7 +59,7 @@ Graph::NodeMap compMap(graph); connectedComponents(graph, compMap); - graphToEps(graph, "connected_components.eps").u(). + graphToEps(graph, "connected_components.eps").undirected(). coords(coords).scaleToA4().enableParallel(). parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). nodeColors(composeMap(colorSet, compMap)).run(); @@ -115,7 +115,8 @@ Graph::NodeMap cutMap(graph); biNodeConnectedComponents(graph, compMap); biNodeConnectedCutNodes(graph, cutMap); - graphToEps(graph, "bi_node_connected_components.eps").u(). + + graphToEps(graph, "bi_node_connected_components.eps").undirected(). coords(coords).scaleToA4().enableParallel(). parEdgeDist(20.0).edgeWidthScale(5.0).nodeScale(20.0). edgeColors(composeMap(colorSet, compMap)). @@ -145,7 +146,7 @@ biEdgeConnectedComponents(graph, compMap); biEdgeConnectedCutEdges(graph, cutMap); - graphToEps(graph, "bi_edge_connected_components.eps").u(). + graphToEps(graph, "bi_edge_connected_components.eps").undirected(). coords(coords).scaleToA4().enableParallel(). parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). nodeColors(composeMap(colorSet, compMap)). @@ -172,7 +173,7 @@ Graph::NodeMap partMap(graph); bipartitePartitions(graph, partMap); - graphToEps(graph, "bipartite_partitions.eps").u(). + graphToEps(graph, "bipartite_partitions.eps").undirected(). coords(coords).scaleToA4().enableParallel(). parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). nodeColors(composeMap(functorMap(&color), partMap)).run(); diff -r 2d806130e700 -r f95eea8c34b0 lemon/Makefile.am --- a/lemon/Makefile.am Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/Makefile.am Thu Jan 26 16:24:40 2006 +0000 @@ -88,6 +88,7 @@ bits/static_map.h \ bits/item_reader.h \ bits/item_writer.h \ + concept/bpugraph.h \ concept/graph.h \ concept/graph_component.h \ concept/ugraph.h \ diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/alteration_notifier.h --- a/lemon/bits/alteration_notifier.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/alteration_notifier.h Thu Jan 26 16:24:40 2006 +0000 @@ -2,7 +2,7 @@ * lemon/notifier.h - Part of LEMON, a generic C++ optimization library * * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). + * (Egervary Research Groin on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For @@ -20,13 +20,13 @@ #include #include -///\ingroup graphmapfactory +///\ingroin graphmapfactory ///\file ///\brief Observer registry for graph alteration observers. namespace lemon { - /// \addtogroup graphmapfactory + /// \addtogroin graphmapfactory /// @{ /// \brief Registry class to register objects observes alterations in @@ -501,30 +501,30 @@ template - class AlterableUBipartiteGraphExtender : public _Base { + class AlterableBpUGraphExtender : public _Base { public: typedef _Base Parent; - typedef AlterableUBipartiteGraphExtender Graph; + typedef AlterableBpUGraphExtender Graph; typedef typename Parent::Node Node; - typedef typename Parent::LowerNode LowerNode; - typedef typename Parent::UpperNode UpperNode; + typedef typename Parent::BNode BNode; + typedef typename Parent::ANode ANode; typedef typename Parent::Edge Edge; typedef typename Parent::UEdge UEdge; typedef AlterationNotifier NodeNotifier; - typedef AlterationNotifier LowerNodeNotifier; - typedef AlterationNotifier UpperNodeNotifier; + typedef AlterationNotifier BNodeNotifier; + typedef AlterationNotifier ANodeNotifier; typedef AlterationNotifier EdgeNotifier; typedef AlterationNotifier UEdgeNotifier; protected: mutable NodeNotifier nodeNotifier; - mutable LowerNodeNotifier lowerNodeNotifier; - mutable UpperNodeNotifier upperNodeNotifier; + mutable BNodeNotifier bNodeNotifier; + mutable ANodeNotifier aNodeNotifier; mutable EdgeNotifier edgeNotifier; mutable UEdgeNotifier uEdgeNotifier; @@ -534,12 +534,12 @@ return nodeNotifier; } - LowerNodeNotifier& getNotifier(LowerNode) const { - return lowerNodeNotifier; + BNodeNotifier& getNotifier(BNode) const { + return bNodeNotifier; } - UpperNodeNotifier& getNotifier(UpperNode) const { - return upperNodeNotifier; + ANodeNotifier& getNotifier(ANode) const { + return aNodeNotifier; } EdgeNotifier& getNotifier(Edge) const { @@ -550,10 +550,10 @@ return uEdgeNotifier; } - ~AlterableUBipartiteGraphExtender() { + ~AlterableBpUGraphExtender() { nodeNotifier.clear(); - lowerNodeNotifier.clear(); - upperNodeNotifier.clear(); + bNodeNotifier.clear(); + aNodeNotifier.clear(); edgeNotifier.clear(); uEdgeNotifier.clear(); } diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/array_map.h --- a/lemon/bits/array_map.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/array_map.h Thu Jan 26 16:24:40 2006 +0000 @@ -2,7 +2,7 @@ * lemon/bits/array_map.h - Part of LEMON, a generic C++ optimization library * * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). + * (Egervary Research Groin on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For @@ -23,19 +23,19 @@ #include #include -/// \ingroup graphmapfactory +/// \ingroin graphmapfactory /// \file /// \brief Graph maps that construct and destruct /// their elements dynamically. namespace lemon { - /// \ingroup graphmapfactory + /// \ingroin graphmapfactory /// /// \brief Graph map based on the array storage. /// /// The ArrayMap template class is graph map structure what - /// automatically updates the map when a key is added to or erased from + /// automatically indates the map when a key is added to or erased from /// the map. This map uses the allocators to implement /// the container functionality. /// diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/clearable_graph_extender.h --- a/lemon/bits/clearable_graph_extender.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/clearable_graph_extender.h Thu Jan 26 16:24:40 2006 +0000 @@ -79,15 +79,15 @@ template - class ClearableUBipartiteGraphExtender : public _Base { + class ClearableBpUGraphExtender : public _Base { public: typedef _Base Parent; - typedef ClearableUBipartiteGraphExtender Graph; + typedef ClearableBpUGraphExtender Graph; typedef typename Parent::Node Node; - typedef typename Parent::LowerNode LowerNode; - typedef typename Parent::UpperNode UpperNode; + typedef typename Parent::BNode BNode; + typedef typename Parent::ANode ANode; typedef typename Parent::Edge Edge; typedef typename Parent::UEdge UEdge; @@ -95,8 +95,8 @@ Parent::getNotifier(Edge()).clear(); Parent::getNotifier(UEdge()).clear(); Parent::getNotifier(Node()).clear(); - Parent::getNotifier(LowerNode()).clear(); - Parent::getNotifier(UpperNode()).clear(); + Parent::getNotifier(BNode()).clear(); + Parent::getNotifier(ANode()).clear(); Parent::clear(); } diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/default_map.h --- a/lemon/bits/default_map.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/default_map.h Thu Jan 26 16:24:40 2006 +0000 @@ -2,7 +2,7 @@ * lemon/default_map.h - Part of LEMON, a generic C++ optimization library * * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). + * (Egervary Research Groin on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For @@ -21,7 +21,7 @@ #include #include -///\ingroup graphmapfactory +///\ingroin graphmapfactory ///\file ///\brief Graph maps that construct and destruct ///their elements dynamically. @@ -352,33 +352,33 @@ template - class MappableUBipartiteGraphExtender : public _Base { + class MappableBpUGraphExtender : public _Base { public: typedef _Base Parent; - typedef MappableUBipartiteGraphExtender Graph; + typedef MappableBpUGraphExtender Graph; typedef typename Parent::Node Node; - typedef typename Parent::UpperNode UpperNode; - typedef typename Parent::LowerNode LowerNode; + typedef typename Parent::ANode ANode; + typedef typename Parent::BNode BNode; typedef typename Parent::Edge Edge; typedef typename Parent::UEdge UEdge; template - class UpperNodeMap - : public IterableMapExtender > { + class ANodeMap + : public IterableMapExtender > { public: - typedef MappableUBipartiteGraphExtender Graph; - typedef IterableMapExtender > + typedef MappableBpUGraphExtender Graph; + typedef IterableMapExtender > Parent; - UpperNodeMap(const Graph& _g) + ANodeMap(const Graph& _g) : Parent(_g) {} - UpperNodeMap(const Graph& _g, const _Value& _v) + ANodeMap(const Graph& _g, const _Value& _v) : Parent(_g, _v) {} - UpperNodeMap& operator=(const UpperNodeMap& cmap) { - return operator=(cmap); + ANodeMap& operator=(const ANodeMap& cmap) { + return operator=(cmap); } @@ -386,13 +386,13 @@ /// /// The given parameter should be conform to the ReadMap /// concept and could be indiced by the current item set of - /// the UpperNodeMap. In this case the value for each item + /// the ANodeMap. In this case the value for each item /// is assigned by the value of the given ReadMap. template - UpperNodeMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + ANodeMap& operator=(const CMap& cmap) { + checkConcept, CMap>(); const typename Parent::Graph* graph = Parent::getGraph(); - UpperNode it; + ANode it; for (graph->first(it); it != INVALID; graph->next(it)) { Parent::set(it, cmap[it]); } @@ -402,20 +402,20 @@ }; template - class LowerNodeMap - : public IterableMapExtender > { + class BNodeMap + : public IterableMapExtender > { public: - typedef MappableUBipartiteGraphExtender Graph; - typedef IterableMapExtender > + typedef MappableBpUGraphExtender Graph; + typedef IterableMapExtender > Parent; - LowerNodeMap(const Graph& _g) + BNodeMap(const Graph& _g) : Parent(_g) {} - LowerNodeMap(const Graph& _g, const _Value& _v) + BNodeMap(const Graph& _g, const _Value& _v) : Parent(_g, _v) {} - LowerNodeMap& operator=(const LowerNodeMap& cmap) { - return operator=(cmap); + BNodeMap& operator=(const BNodeMap& cmap) { + return operator=(cmap); } @@ -423,13 +423,13 @@ /// /// The given parameter should be conform to the ReadMap /// concept and could be indiced by the current item set of - /// the LowerNodeMap. In this case the value for each item + /// the BNodeMap. In this case the value for each item /// is assigned by the value of the given ReadMap. template - LowerNodeMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + BNodeMap& operator=(const CMap& cmap) { + checkConcept, CMap>(); const typename Parent::Graph* graph = Parent::getGraph(); - LowerNode it; + BNode it; for (graph->first(it); it != INVALID; graph->next(it)) { Parent::set(it, cmap[it]); } @@ -443,32 +443,32 @@ template class NodeMapBase : public Parent::NodeNotifier::ObserverBase { public: - typedef MappableUBipartiteGraphExtender Graph; + typedef MappableBpUGraphExtender Graph; typedef Node Key; typedef _Value Value; /// The reference type of the map; - typedef typename LowerNodeMap<_Value>::Reference Reference; + typedef typename BNodeMap<_Value>::Reference Reference; /// The pointer type of the map; - typedef typename LowerNodeMap<_Value>::Pointer Pointer; + typedef typename BNodeMap<_Value>::Pointer Pointer; /// The const value type of the map. typedef const Value ConstValue; /// The const reference type of the map; - typedef typename LowerNodeMap<_Value>::ConstReference ConstReference; + typedef typename BNodeMap<_Value>::ConstReference ConstReference; /// The pointer type of the map; - typedef typename LowerNodeMap<_Value>::ConstPointer ConstPointer; + typedef typename BNodeMap<_Value>::ConstPointer ConstPointer; typedef True ReferenceMapTag; NodeMapBase(const Graph& _g) - : graph(&_g), lowerMap(_g), upperMap(_g) { + : graph(&_g), bNodeMap(_g), aNodeMap(_g) { Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node())); } NodeMapBase(const Graph& _g, const _Value& _v) - : graph(&_g), lowerMap(_g, _v), - upperMap(_g, _v) { + : graph(&_g), bNodeMap(_g, _v), + aNodeMap(_g, _v) { Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node())); } @@ -479,26 +479,26 @@ } ConstReference operator[](const Key& node) const { - if (Parent::upper(node)) { - return upperMap[node]; + if (Parent::aNode(node)) { + return aNodeMap[node]; } else { - return lowerMap[node]; + return bNodeMap[node]; } } Reference operator[](const Key& node) { - if (Parent::upper(node)) { - return upperMap[node]; + if (Parent::aNode(node)) { + return aNodeMap[node]; } else { - return lowerMap[node]; + return bNodeMap[node]; } } void set(const Key& node, const Value& value) { - if (Parent::upper(node)) { - upperMap.set(node, value); + if (Parent::aNode(node)) { + aNodeMap.set(node, value); } else { - lowerMap.set(node, value); + bNodeMap.set(node, value); } } @@ -513,8 +513,8 @@ private: const Graph* graph; - LowerNodeMap<_Value> lowerMap; - UpperNodeMap<_Value> upperMap; + BNodeMap<_Value> bNodeMap; + ANodeMap<_Value> aNodeMap; }; public: @@ -523,7 +523,7 @@ class NodeMap : public IterableMapExtender > { public: - typedef MappableUBipartiteGraphExtender Graph; + typedef MappableBpUGraphExtender Graph; typedef IterableMapExtender< NodeMapBase<_Value> > Parent; NodeMap(const Graph& _g) @@ -561,7 +561,7 @@ class EdgeMap : public IterableMapExtender > { public: - typedef MappableUBipartiteGraphExtender Graph; + typedef MappableBpUGraphExtender Graph; typedef IterableMapExtender > Parent; EdgeMap(const Graph& _g) @@ -589,7 +589,7 @@ class UEdgeMap : public IterableMapExtender > { public: - typedef MappableUBipartiteGraphExtender Graph; + typedef MappableBpUGraphExtender Graph; typedef IterableMapExtender > Parent; diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/extendable_graph_extender.h --- a/lemon/bits/extendable_graph_extender.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/extendable_graph_extender.h Thu Jan 26 16:24:40 2006 +0000 @@ -105,28 +105,28 @@ template - class ExtendableUBipartiteGraphExtender : public _Base { + class ExtendableBpUGraphExtender : public _Base { public: typedef _Base Parent; - typedef ExtendableUBipartiteGraphExtender Graph; + typedef ExtendableBpUGraphExtender Graph; typedef typename Parent::Node Node; - typedef typename Parent::LowerNode LowerNode; - typedef typename Parent::UpperNode UpperNode; + typedef typename Parent::BNode BNode; + typedef typename Parent::ANode ANode; typedef typename Parent::Edge Edge; typedef typename Parent::UEdge UEdge; - Node addUpperNode() { - Node node = Parent::addUpperNode(); - Parent::getNotifier(UpperNode()).add(node); + Node addANode() { + Node node = Parent::addANode(); + Parent::getNotifier(ANode()).add(node); Parent::getNotifier(Node()).add(node); return node; } - Node addLowerNode() { - Node node = Parent::addLowerNode(); - Parent::getNotifier(LowerNode()).add(node); + Node addBNode() { + Node node = Parent::addBNode(); + Parent::getNotifier(BNode()).add(node); Parent::getNotifier(Node()).add(node); return node; } diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/graph_extender.h --- a/lemon/bits/graph_extender.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/graph_extender.h Thu Jan 26 16:24:40 2006 +0000 @@ -2,7 +2,7 @@ * lemon/graph_extender.h - Part of LEMON, a generic C++ optimization library * * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi - * Kutatocsoport (Egervary Research Group on Combinatorial Optimization, + * Kutatocsoport (Egervary Research Groin on Combinatorial Optimization, * EGRES). * * Permission to use, modify and distribute this software is granted @@ -379,10 +379,10 @@ template - class UBipartiteGraphExtender : public _Base { + class BpUGraphExtender : public _Base { public: typedef _Base Parent; - typedef UBipartiteGraphExtender Graph; + typedef BpUGraphExtender Graph; typedef typename Parent::Node Node; typedef typename Parent::Edge UEdge; @@ -393,26 +393,26 @@ using Parent::id; Node source(const UEdge& edge) const { - return upperNode(edge); + return aNode(edge); } Node target(const UEdge& edge) const { - return lowerNode(edge); + return bNode(edge); } void firstInc(UEdge& edge, bool& direction, const Node& node) const { - if (Parent::upper(node)) { - Parent::firstDown(edge, node); + if (Parent::aNode(node)) { + Parent::firstOut(edge, node); direction = true; } else { - Parent::firstUp(edge, node); + Parent::firstIn(edge, node); direction = static_cast(edge) == INVALID; } } void nextInc(UEdge& edge, bool& direction) const { if (direction) { - Parent::nextDown(edge); + Parent::nextOut(edge); } else { - Parent::nextUp(edge); + Parent::nextIn(edge); if (edge == INVALID) direction = true; } } @@ -426,7 +426,7 @@ } class Edge : public UEdge { - friend class UBipartiteGraphExtender; + friend class BpUGraphExtender; protected: bool forward; @@ -461,46 +461,46 @@ } void firstOut(Edge& edge, const Node& node) const { - if (Parent::upper(node)) { - Parent::firstDown(edge, node); + if (Parent::aNode(node)) { + Parent::firstOut(edge, node); edge.forward = true; } else { - Parent::firstUp(edge, node); + Parent::firstIn(edge, node); edge.forward = static_cast(edge) == INVALID; } } void nextOut(Edge& edge) const { if (edge.forward) { - Parent::nextDown(edge); + Parent::nextOut(edge); } else { - Parent::nextUp(edge); + Parent::nextIn(edge); edge.forward = static_cast(edge) == INVALID; } } void firstIn(Edge& edge, const Node& node) const { - if (Parent::lower(node)) { - Parent::firstUp(edge, node); + if (Parent::bNode(node)) { + Parent::firstIn(edge, node); edge.forward = true; } else { - Parent::firstDown(edge, node); + Parent::firstOut(edge, node); edge.forward = static_cast(edge) == INVALID; } } void nextIn(Edge& edge) const { if (edge.forward) { - Parent::nextUp(edge); + Parent::nextIn(edge); } else { - Parent::nextDown(edge); + Parent::nextOut(edge); edge.forward = static_cast(edge) == INVALID; } } Node source(const Edge& edge) const { - return edge.forward ? Parent::upperNode(edge) : Parent::lowerNode(edge); + return edge.forward ? Parent::aNode(edge) : Parent::bNode(edge); } Node target(const Edge& edge) const { - return edge.forward ? Parent::lowerNode(edge) : Parent::upperNode(edge); + return edge.forward ? Parent::bNode(edge) : Parent::aNode(edge); } bool direction(const Edge& edge) const { @@ -534,48 +534,48 @@ return (Parent::maxId(UEdge()) << 1) + 1; } - class UpperNode : public Node { - friend class UBipartiteGraphExtender; + class ANode : public Node { + friend class BpUGraphExtender; public: - UpperNode() {} - UpperNode(const Node& node) : Node(node) { - LEMON_ASSERT(Parent::upper(node) || node == INVALID, + ANode() {} + ANode(const Node& node) : Node(node) { + LEMON_ASSERT(Parent::aNode(node) || node == INVALID, typename Parent::NodeSetError()); } - UpperNode(Invalid) : Node(INVALID) {} + ANode(Invalid) : Node(INVALID) {} }; - void first(UpperNode& node) const { - Parent::firstUpper(static_cast(node)); + void first(ANode& node) const { + Parent::firstANode(static_cast(node)); } - void next(UpperNode& node) const { - Parent::nextUpper(static_cast(node)); + void next(ANode& node) const { + Parent::nextANode(static_cast(node)); } - int id(const UpperNode& node) const { - return Parent::upperId(node); + int id(const ANode& node) const { + return Parent::aNodeId(node); } - class LowerNode : public Node { - friend class UBipartiteGraphExtender; + class BNode : public Node { + friend class BpUGraphExtender; public: - LowerNode() {} - LowerNode(const Node& node) : Node(node) { - LEMON_ASSERT(Parent::lower(node) || node == INVALID, + BNode() {} + BNode(const Node& node) : Node(node) { + LEMON_ASSERT(Parent::bNode(node) || node == INVALID, typename Parent::NodeSetError()); } - LowerNode(Invalid) : Node(INVALID) {} + BNode(Invalid) : Node(INVALID) {} }; - void first(LowerNode& node) const { - Parent::firstLower(static_cast(node)); + void first(BNode& node) const { + Parent::firstBNode(static_cast(node)); } - void next(LowerNode& node) const { - Parent::nextLower(static_cast(node)); + void next(BNode& node) const { + Parent::nextBNode(static_cast(node)); } - int id(const LowerNode& node) const { - return Parent::upperId(node); + int id(const BNode& node) const { + return Parent::aNodeId(node); } @@ -583,11 +583,11 @@ int maxId(Node) const { return Parent::maxNodeId(); } - int maxId(LowerNode) const { - return Parent::maxLowerId(); + int maxId(BNode) const { + return Parent::maxBNodeId(); } - int maxId(UpperNode) const { - return Parent::maxUpperId(); + int maxId(ANode) const { + return Parent::maxANodeId(); } int maxId(Edge) const { return maxEdgeId(); @@ -600,11 +600,11 @@ Node fromId(int id, Node) const { return Parent::nodeFromId(id); } - UpperNode fromId(int id, UpperNode) const { - return Parent::fromUpperId(id); + ANode fromId(int id, ANode) const { + return Parent::fromANodeId(id); } - LowerNode fromId(int id, LowerNode) const { - return Parent::fromLowerId(id); + BNode fromId(int id, BNode) const { + return Parent::fromBNodeId(id); } Edge fromId(int id, Edge) const { return edgeFromId(id); diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/item_reader.h --- a/lemon/bits/item_reader.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/item_reader.h Thu Jan 26 16:24:40 2006 +0000 @@ -2,7 +2,7 @@ * lemon/bits/item_reader.h - Part of LEMON, a generic C++ optimization library * * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). + * (Egervary Research Groin on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For @@ -14,15 +14,15 @@ * */ -/// @defgroup item_io Item Readers and Writers -/// @ingroup io_group +/// @defgroin item_io Item Readers and Writers +/// @ingroin io_groin /// \brief Item Readers and Writers /// /// The Input-Output classes can handle more data type by example /// as map or attribute value. Each of these should be written and /// read some way. The module make possible to do this. -/// \ingroup item_io +/// \ingroin item_io /// \file /// \brief Item reader bits for lemon input. @@ -42,7 +42,7 @@ template class DefaultReader; - /// \ingroup item_io + /// \ingroin item_io /// /// \brief Reader class for quoted strings. /// @@ -157,7 +157,7 @@ bool escaped; }; - /// \ingroup item_io + /// \ingroin item_io /// \brief Reader for standard containers. /// /// Reader for back insertable standard containers. The representation @@ -204,7 +204,7 @@ }; - /// \ingroup item_io + /// \ingroin item_io /// /// \brief Reader for standard containers. /// @@ -252,7 +252,7 @@ }; - /// \ingroup item_io + /// \ingroin item_io /// \brief Reader for parsed string. /// /// Reader for parsed strings. You can define the open and close @@ -300,7 +300,7 @@ }; - /// \ingroup item_io + /// \ingroin item_io /// \brief Reader for read the whole line. /// /// Reader for read the whole line. @@ -330,7 +330,7 @@ bool skipSpaces; }; - /// \ingroup item_io + /// \ingroin item_io /// \brief Reader for std::pair. /// /// Reader for std::pair. @@ -384,7 +384,7 @@ } }; - /// \ingroup item_io + /// \ingroin item_io /// /// \brief The default item reader template class. /// @@ -471,7 +471,7 @@ class DefaultReader > : public PairReader > {}; - /// \ingroup item_io + /// \ingroin item_io /// /// \brief The default item reader for skipping a value in the stream. /// @@ -480,7 +480,7 @@ /// \author Balazs Dezso class DefaultSkipper : public DefaultReader {}; - /// \ingroup item_io + /// \ingroin item_io /// \brief Standard ReaderTraits for the GraphReader class. /// /// Standard ReaderTraits for the GraphReader class. diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/item_writer.h --- a/lemon/bits/item_writer.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/item_writer.h Thu Jan 26 16:24:40 2006 +0000 @@ -2,7 +2,7 @@ * lemon/bits/item_reader.h - Part of LEMON, a generic C++ optimization library * * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). + * (Egervary Research Groin on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For @@ -14,7 +14,7 @@ * */ -/// \ingroup item_io +/// \ingroin item_io /// \file /// \brief Item writer bits for lemon output. @@ -34,7 +34,7 @@ template class DefaultWriter; - /// \ingroup item_io + /// \ingroin item_io /// \brief Writer class for quoted strings. /// /// Writer class for quoted strings. It can process the escape @@ -117,7 +117,7 @@ bool escaped; }; - /// \ingroup item_io + /// \ingroin item_io /// \brief Writer class for quoted char array. /// /// Writer class for quoted char array. It can process the escape @@ -145,7 +145,7 @@ }; - /// \ingroup item_io + /// \ingroin item_io /// /// \brief Writer for standard containers. /// @@ -187,7 +187,7 @@ }; - /// \ingroup item_io + /// \ingroin item_io /// /// \brief Writer for standard pairs. /// @@ -234,7 +234,7 @@ }; - /// \ingroup item_io + /// \ingroin item_io /// /// \brief The default item writer template class. /// @@ -307,7 +307,7 @@ class DefaultWriter > : public PairWriter > {}; - /// \ingroup item_io + /// \ingroin item_io /// \brief Standard WriterTraits for the section writers. /// /// Standard WriterTraits for the section writers. diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/iterable_graph_extender.h --- a/lemon/bits/iterable_graph_extender.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/iterable_graph_extender.h Thu Jan 26 16:24:40 2006 +0000 @@ -270,14 +270,14 @@ template - class IterableUBipartiteGraphExtender : public _Base { + class IterableBpUGraphExtender : public _Base { public: typedef _Base Parent; - typedef IterableUBipartiteGraphExtender Graph; + typedef IterableBpUGraphExtender Graph; typedef typename Parent::Node Node; - typedef typename Parent::UpperNode UpperNode; - typedef typename Parent::LowerNode LowerNode; + typedef typename Parent::ANode ANode; + typedef typename Parent::BNode BNode; typedef typename Parent::Edge Edge; typedef typename Parent::UEdge UEdge; @@ -303,52 +303,52 @@ }; - class UpperNodeIt : public Node { - friend class IterableUBipartiteGraphExtender; + class ANodeIt : public Node { + friend class IterableBpUGraphExtender; const Graph* graph; public: - UpperNodeIt() { } + ANodeIt() { } - UpperNodeIt(Invalid i) : Node(INVALID) { } + ANodeIt(Invalid i) : Node(INVALID) { } - explicit UpperNodeIt(const Graph& _graph) : graph(&_graph) { - graph->firstUpper(static_cast(*this)); + explicit ANodeIt(const Graph& _graph) : graph(&_graph) { + graph->firstANode(static_cast(*this)); } - UpperNodeIt(const Graph& _graph, const Node& node) + ANodeIt(const Graph& _graph, const Node& node) : Node(node), graph(&_graph) {} - UpperNodeIt& operator++() { - graph->nextUpper(*this); + ANodeIt& operator++() { + graph->nextANode(*this); return *this; } }; - class LowerNodeIt : public Node { - friend class IterableUBipartiteGraphExtender; + class BNodeIt : public Node { + friend class IterableBpUGraphExtender; const Graph* graph; public: - LowerNodeIt() { } + BNodeIt() { } - LowerNodeIt(Invalid i) : Node(INVALID) { } + BNodeIt(Invalid i) : Node(INVALID) { } - explicit LowerNodeIt(const Graph& _graph) : graph(&_graph) { - graph->firstLower(static_cast(*this)); + explicit BNodeIt(const Graph& _graph) : graph(&_graph) { + graph->firstBNode(static_cast(*this)); } - LowerNodeIt(const Graph& _graph, const Node& node) + BNodeIt(const Graph& _graph, const Node& node) : Node(node), graph(&_graph) {} - LowerNodeIt& operator++() { - graph->nextLower(*this); + BNodeIt& operator++() { + graph->nextBNode(*this); return *this; } }; class EdgeIt : public Edge { - friend class IterableUBipartiteGraphExtender; + friend class IterableBpUGraphExtender; const Graph* graph; public: @@ -371,7 +371,7 @@ }; class UEdgeIt : public UEdge { - friend class IterableUBipartiteGraphExtender; + friend class IterableBpUGraphExtender; const Graph* graph; public: @@ -393,7 +393,7 @@ }; class OutEdgeIt : public Edge { - friend class IterableUBipartiteGraphExtender; + friend class IterableBpUGraphExtender; const Graph* graph; public: @@ -418,7 +418,7 @@ class InEdgeIt : public Edge { - friend class IterableUBipartiteGraphExtender; + friend class IterableBpUGraphExtender; const Graph* graph; public: @@ -470,7 +470,7 @@ } class IncEdgeIt : public Parent::UEdge { - friend class IterableUBipartiteGraphExtender; + friend class IterableBpUGraphExtender; const Graph* graph; bool direction; public: diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/map_extender.h --- a/lemon/bits/map_extender.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/map_extender.h Thu Jan 26 16:24:40 2006 +0000 @@ -2,7 +2,7 @@ * lemon/map_extender.h - Part of LEMON, a generic C++ optimization library * * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). + * (Egervary Research Groin on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/static_map.h --- a/lemon/bits/static_map.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/static_map.h Thu Jan 26 16:24:40 2006 +0000 @@ -2,7 +2,7 @@ * lemon/static_map.h - Part of LEMON, a generic C++ optimization library * * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). + * (Egervary Research Groin on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For @@ -27,19 +27,19 @@ #include #include -/// \ingroup graphmaps +/// \ingroin graphmaps /// ///\file ///\brief Static sized graph maps. namespace lemon { - /// \ingroup graphmaps + /// \ingroin graphmaps /// /// \brief Graph map with static sized storage. /// /// The StaticMap template class is graph map structure what - /// does not update automatically the map when a key is added to or + /// does not indate automatically the map when a key is added to or /// erased from the map rather it throws an exception. This map factory /// uses the allocators to implement the container functionality. /// @@ -54,11 +54,11 @@ class StaticMap : public AlterationNotifier<_Item>::ObserverBase { public: - /// \brief Exception class for unsupported exceptions. - class UnsupportedOperation : public lemon::LogicError { + /// \brief Exception class for unsinported exceptions. + class UnsinportedOperation : public lemon::LogicError { public: virtual const char* exceptionName() const { - return "lemon::StaticMap::UnsupportedOperation"; + return "lemon::StaticMap::UnsinportedOperation"; } }; @@ -185,7 +185,7 @@ /// and it overrides the add() member function of the observer base. void add(const Key&) { - throw UnsupportedOperation(); + throw UnsinportedOperation(); } /// \brief Erases a key from the map. @@ -193,7 +193,7 @@ /// Erase a key from the map. It called by the observer registry /// and it overrides the erase() member function of the observer base. void erase(const Key&) { - throw UnsupportedOperation(); + throw UnsinportedOperation(); } /// Buildes the map. @@ -346,33 +346,33 @@ }; template - class StaticMappableUBipartiteGraphExtender : public _Base { + class StaticMappableBpUGraphExtender : public _Base { public: typedef _Base Parent; - typedef StaticMappableUBipartiteGraphExtender Graph; + typedef StaticMappableBpUGraphExtender Graph; typedef typename Parent::Node Node; - typedef typename Parent::UpperNode UpperNode; - typedef typename Parent::LowerNode LowerNode; + typedef typename Parent::ANode ANode; + typedef typename Parent::BNode BNode; typedef typename Parent::Edge Edge; typedef typename Parent::UEdge UEdge; template - class UpperNodeMap - : public IterableMapExtender > { + class ANodeMap + : public IterableMapExtender > { public: - typedef StaticMappableUBipartiteGraphExtender Graph; - typedef IterableMapExtender > + typedef StaticMappableBpUGraphExtender Graph; + typedef IterableMapExtender > Parent; - UpperNodeMap(const Graph& _g) + ANodeMap(const Graph& _g) : Parent(_g) {} - UpperNodeMap(const Graph& _g, const _Value& _v) + ANodeMap(const Graph& _g, const _Value& _v) : Parent(_g, _v) {} - UpperNodeMap& operator=(const UpperNodeMap& cmap) { - return operator=(cmap); + ANodeMap& operator=(const ANodeMap& cmap) { + return operator=(cmap); } @@ -380,13 +380,13 @@ /// /// The given parameter should be conform to the ReadMap /// concept and could be indiced by the current item set of - /// the UpperNodeMap. In this case the value for each item + /// the ANodeMap. In this case the value for each item /// is assigned by the value of the given ReadMap. template - UpperNodeMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + ANodeMap& operator=(const CMap& cmap) { + checkConcept, CMap>(); const typename Parent::Graph* graph = Parent::getGraph(); - UpperNode it; + ANode it; for (graph->first(it); it != INVALID; graph->next(it)) { Parent::set(it, cmap[it]); } @@ -396,20 +396,20 @@ }; template - class LowerNodeMap - : public IterableMapExtender > { + class BNodeMap + : public IterableMapExtender > { public: - typedef StaticMappableUBipartiteGraphExtender Graph; - typedef IterableMapExtender > + typedef StaticMappableBpUGraphExtender Graph; + typedef IterableMapExtender > Parent; - LowerNodeMap(const Graph& _g) + BNodeMap(const Graph& _g) : Parent(_g) {} - LowerNodeMap(const Graph& _g, const _Value& _v) + BNodeMap(const Graph& _g, const _Value& _v) : Parent(_g, _v) {} - LowerNodeMap& operator=(const LowerNodeMap& cmap) { - return operator=(cmap); + BNodeMap& operator=(const BNodeMap& cmap) { + return operator=(cmap); } @@ -417,13 +417,13 @@ /// /// The given parameter should be conform to the ReadMap /// concept and could be indiced by the current item set of - /// the LowerNodeMap. In this case the value for each item + /// the BNodeMap. In this case the value for each item /// is assigned by the value of the given ReadMap. template - LowerNodeMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + BNodeMap& operator=(const CMap& cmap) { + checkConcept, CMap>(); const typename Parent::Graph* graph = Parent::getGraph(); - LowerNode it; + BNode it; for (graph->first(it); it != INVALID; graph->next(it)) { Parent::set(it, cmap[it]); } @@ -437,32 +437,32 @@ template class NodeMapBase : public Parent::NodeNotifier::ObserverBase { public: - typedef StaticMappableUBipartiteGraphExtender Graph; + typedef StaticMappableBpUGraphExtender Graph; typedef Node Key; typedef _Value Value; /// The reference type of the map; - typedef typename LowerNodeMap<_Value>::Reference Reference; + typedef typename BNodeMap<_Value>::Reference Reference; /// The pointer type of the map; - typedef typename LowerNodeMap<_Value>::Pointer Pointer; + typedef typename BNodeMap<_Value>::Pointer Pointer; /// The const value type of the map. typedef const Value ConstValue; /// The const reference type of the map; - typedef typename LowerNodeMap<_Value>::ConstReference ConstReference; + typedef typename BNodeMap<_Value>::ConstReference ConstReference; /// The pointer type of the map; - typedef typename LowerNodeMap<_Value>::ConstPointer ConstPointer; + typedef typename BNodeMap<_Value>::ConstPointer ConstPointer; typedef True ReferenceMapTag; NodeMapBase(const Graph& _g) - : graph(&_g), lowerMap(_g), upperMap(_g) { + : graph(&_g), bNodeMap(_g), aNodeMap(_g) { Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node())); } NodeMapBase(const Graph& _g, const _Value& _v) - : graph(&_g), lowerMap(_g, _v), - upperMap(_g, _v) { + : graph(&_g), bNodeMap(_g, _v), + aNodeMap(_g, _v) { Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node())); } @@ -473,26 +473,26 @@ } ConstReference operator[](const Key& node) const { - if (Parent::upper(node)) { - return upperMap[node]; + if (Parent::aNode(node)) { + return aNodeMap[node]; } else { - return lowerMap[node]; + return bNodeMap[node]; } } Reference operator[](const Key& node) { - if (Parent::upper(node)) { - return upperMap[node]; + if (Parent::aNode(node)) { + return aNodeMap[node]; } else { - return lowerMap[node]; + return bNodeMap[node]; } } void set(const Key& node, const Value& value) { - if (Parent::upper(node)) { - upperMap.set(node, value); + if (Parent::aNode(node)) { + aNodeMap.set(node, value); } else { - lowerMap.set(node, value); + bNodeMap.set(node, value); } } @@ -507,8 +507,8 @@ private: const Graph* graph; - LowerNodeMap<_Value> lowerMap; - UpperNodeMap<_Value> upperMap; + BNodeMap<_Value> bNodeMap; + ANodeMap<_Value> aNodeMap; }; public: @@ -517,7 +517,7 @@ class NodeMap : public IterableMapExtender > { public: - typedef StaticMappableUBipartiteGraphExtender Graph; + typedef StaticMappableBpUGraphExtender Graph; typedef IterableMapExtender< NodeMapBase<_Value> > Parent; NodeMap(const Graph& _g) @@ -555,7 +555,7 @@ class EdgeMap : public IterableMapExtender > { public: - typedef StaticMappableUBipartiteGraphExtender Graph; + typedef StaticMappableBpUGraphExtender Graph; typedef IterableMapExtender > Parent; EdgeMap(const Graph& _g) @@ -583,7 +583,7 @@ class UEdgeMap : public IterableMapExtender > { public: - typedef StaticMappableUBipartiteGraphExtender Graph; + typedef StaticMappableBpUGraphExtender Graph; typedef IterableMapExtender > Parent; diff -r 2d806130e700 -r f95eea8c34b0 lemon/bits/vector_map.h --- a/lemon/bits/vector_map.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/bits/vector_map.h Thu Jan 26 16:24:40 2006 +0000 @@ -2,7 +2,7 @@ * lemon/vector_map.h - Part of LEMON, a generic C++ optimization library * * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). + * (Egervary Research Groin on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For @@ -26,19 +26,19 @@ #include #include -/// \ingroup graphmapfactory +/// \ingroin graphmapfactory /// ///\file ///\brief Vector based graph maps. namespace lemon { - /// \ingroup graphmapfactory + /// \ingroin graphmapfactory /// /// \brief Graph map based on the std::vector storage. /// /// The VectorMap template class is graph map structure what - /// automatically updates the map when a key is added to or erased from + /// automatically indates the map when a key is added to or erased from /// the map. This map factory uses the allocators to implement /// the container functionality. This map factory /// uses the std::vector to implement the container function. diff -r 2d806130e700 -r f95eea8c34b0 lemon/concept/ugraph.h --- a/lemon/concept/ugraph.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/concept/ugraph.h Thu Jan 26 16:24:40 2006 +0000 @@ -22,8 +22,8 @@ ///\brief Undirected graphs and components of. -#ifndef LEMON_CONCEPT_UNDIR_GRAPH_H -#define LEMON_CONCEPT_UNDIR_GRAPH_H +#ifndef LEMON_CONCEPT_UGRAPH_H +#define LEMON_CONCEPT_UGRAPH_H #include #include diff -r 2d806130e700 -r f95eea8c34b0 lemon/full_graph.h --- a/lemon/full_graph.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/full_graph.h Thu Jan 26 16:24:40 2006 +0000 @@ -403,11 +403,11 @@ }; - class FullUBipartiteGraphBase { + class FullBpUGraphBase { protected: - int _upperNodeNum; - int _lowerNodeNum; + int _aNodeNum; + int _bNodeNum; int _edgeNum; @@ -415,12 +415,12 @@ class NodeSetError : public LogicError { virtual const char* exceptionName() const { - return "lemon::FullUBipartiteGraph::NodeSetError"; + return "lemon::FullBpUGraph::NodeSetError"; } }; class Node { - friend class FullUBipartiteGraphBase; + friend class FullBpUGraphBase; protected: int id; @@ -434,7 +434,7 @@ }; class Edge { - friend class FullUBipartiteGraphBase; + friend class FullBpUGraphBase; protected: int id; @@ -447,39 +447,39 @@ bool operator<(const Edge i) const {return id 0) { - node.id = 2 * _upperNodeNum - 2; + if (_aNodeNum > 0) { + node.id = 2 * _aNodeNum - 2; } else { - node.id = 2 * _lowerNodeNum - 1; + node.id = 2 * _bNodeNum - 1; } } void next(Node& node) const { node.id -= 2; if (node.id == -2) { - node.id = 2 * _lowerNodeNum - 1; + node.id = 2 * _bNodeNum - 1; } } @@ -490,21 +490,21 @@ --edge.id; } - void firstDown(Edge& edge, const Node& node) const { + void firstOut(Edge& edge, const Node& node) const { LEMON_ASSERT((node.id & 1) == 0, NodeSetError()); - edge.id = (node.id >> 1) * _lowerNodeNum; + edge.id = (node.id >> 1) * _bNodeNum; } - void nextDown(Edge& edge) const { + void nextOut(Edge& edge) const { ++(edge.id); - if (edge.id % _lowerNodeNum == 0) edge.id = -1; + if (edge.id % _bNodeNum == 0) edge.id = -1; } - void firstUp(Edge& edge, const Node& node) const { + void firstIn(Edge& edge, const Node& node) const { LEMON_ASSERT((node.id & 1) == 1, NodeSetError()); edge.id = (node.id >> 1); } - void nextUp(Edge& edge) const { - edge.id += _lowerNodeNum; + void nextIn(Edge& edge) const { + edge.id += _bNodeNum; if (edge.id >= _edgeNum) edge.id = -1; } @@ -515,8 +515,8 @@ return Node(id); } int maxNodeId() const { - return _upperNodeNum > _lowerNodeNum ? - _upperNodeNum * 2 - 2 : _lowerNodeNum * 2 - 1; + return _aNodeNum > _bNodeNum ? + _aNodeNum * 2 - 2 : _bNodeNum * 2 - 1; } static int id(const Edge& edge) { @@ -529,66 +529,77 @@ return _edgeNum - 1; } - static int upperId(const Node& node) { + static int aNodeId(const Node& node) { return node.id >> 1; } - static Node fromUpperId(int id, Node) { + static Node fromANodeId(int id, Node) { return Node(id << 1); } - int maxUpperId() const { - return _upperNodeNum; + int maxANodeId() const { + return _aNodeNum; } - static int lowerId(const Node& node) { + static int bNodeId(const Node& node) { return node.id >> 1; } - static Node fromLowerId(int id) { + static Node fromBNodeId(int id) { return Node((id << 1) + 1); } - int maxLowerId() const { - return _lowerNodeNum; + int maxBNodeId() const { + return _bNodeNum; } - Node upperNode(const Edge& edge) const { - return Node((edge.id / _lowerNodeNum) << 1); + Node aNode(const Edge& edge) const { + return Node((edge.id / _bNodeNum) << 1); } - Node lowerNode(const Edge& edge) const { - return Node(((edge.id % _lowerNodeNum) << 1) + 1); + Node bNode(const Edge& edge) const { + return Node(((edge.id % _bNodeNum) << 1) + 1); } - static bool upper(const Node& node) { + static bool aNode(const Node& node) { return (node.id & 1) == 0; } - static bool lower(const Node& node) { + static bool bNode(const Node& node) { return (node.id & 1) == 1; } - static Node upperNode(int index) { + static Node aNode(int index) { return Node(index << 1); } - static Node lowerNode(int index) { + static Node bNode(int index) { return Node((index << 1) + 1); } }; - typedef StaticMappableUBipartiteGraphExtender< - IterableUBipartiteGraphExtender< - AlterableUBipartiteGraphExtender< - UBipartiteGraphExtender < - FullUBipartiteGraphBase> > > > - ExtendedFullUBipartiteGraphBase; + typedef StaticMappableBpUGraphExtender< + IterableBpUGraphExtender< + AlterableBpUGraphExtender< + BpUGraphExtender < + FullBpUGraphBase> > > > + ExtendedFullBpUGraphBase; - class FullUBipartiteGraph : - public ExtendedFullUBipartiteGraphBase { + /// \ingroup graphs + /// + /// \brief An undirected full bipartite graph class. + /// + /// This is a simple and fast bipartite undirected full graph implementation. + /// It is completely static, so you can neither add nor delete either + /// edges or nodes. + /// + /// \sa FullGraph + /// + /// \author Balazs Dezso + class FullBpUGraph : + public ExtendedFullBpUGraphBase { public: - typedef ExtendedFullUBipartiteGraphBase Parent; - FullUBipartiteGraph(int upperNodeNum, int lowerNodeNum) { - Parent::construct(upperNodeNum, lowerNodeNum); + typedef ExtendedFullBpUGraphBase Parent; + FullBpUGraph(int aNodeNum, int bNodeNum) { + Parent::construct(aNodeNum, bNodeNum); } }; diff -r 2d806130e700 -r f95eea8c34b0 lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/graph_to_eps.h Thu Jan 26 16:24:40 2006 +0000 @@ -234,7 +234,8 @@ ConstMap _nodePsTexts; char *_nodePsTextsPreamble; - bool _u; + bool _undirected; + bool _pleaseRemoveOsStream; bool _scaleToA4; @@ -272,7 +273,7 @@ _enableParallel(false), _parEdgeDist(1), _showNodeText(false), _nodeTexts(false), _nodeTextSize(1), _showNodePsText(false), _nodePsTexts(false), _nodePsTextsPreamble(0), - _u(false), + _undirected(false), _pleaseRemoveOsStream(_pros), _scaleToA4(false), _nodeTextColorType(SAME_COL), _nodeTextColors(Color(0,0,0)), _autoNodeScale(false), @@ -329,7 +330,8 @@ using T::_nodePsTexts; using T::_nodePsTextsPreamble; - using T::_u; + using T::_undirected; + using T::_pleaseRemoveOsStream; using T::_scaleToA4; @@ -734,12 +736,13 @@ ///Sets whether the the graph is undirected /// - GraphToEps &u(bool b=true) {_u=b;return *this;} + GraphToEps &undirected(bool b=true) {_undirected=b;return *this;} + ///Sets whether the the graph is directed ///Sets whether the the graph is directed. ///Use it to show the undirected edges as a pair of directed ones. - GraphToEps &bidir(bool b=true) {_u=!b;return *this;} + GraphToEps &bidir(bool b=true) {_undirected=!b;return *this;} ///Sets the title. @@ -958,7 +961,7 @@ if(_enableParallel) { std::vector el; for(EdgeIt e(g);e!=INVALID;++e) - if((!_u||g.source(e)0) + if((!_undirected||g.source(e)0) el.push_back(e); std::sort(el.begin(),el.end(),edgeLess(g)); @@ -1046,7 +1049,7 @@ } } else for(EdgeIt e(g);e!=INVALID;++e) - if((!_u||g.source(e)0) + if((!_undirected||g.source(e)0) if(_drawArrows) { xy d(mycoords[g.target(e)]-mycoords[g.source(e)]); double rn=_nodeSizes[g.target(e)]*_nodeScale; diff -r 2d806130e700 -r f95eea8c34b0 lemon/smart_graph.h --- a/lemon/smart_graph.h Thu Jan 26 15:42:13 2006 +0000 +++ b/lemon/smart_graph.h Thu Jan 26 16:24:40 2006 +0000 @@ -378,12 +378,12 @@ }; - class SmartUBipartiteGraphBase { + class SmartBpUGraphBase { public: class NodeSetError : public LogicError { virtual const char* exceptionName() const { - return "lemon::FullUBipartiteGraph::NodeSetError"; + return "lemon::SmartBpUGraph::NodeSetError"; } }; @@ -396,19 +396,19 @@ }; struct EdgeT { - int upper, next_down; - int lower, next_up; + int aNode, next_out; + int bNode, next_in; }; - std::vector upperNodes; - std::vector lowerNodes; + std::vector aNodes; + std::vector bNodes; std::vector edges; public: class Node { - friend class SmartUBipartiteGraphBase; + friend class SmartBpUGraphBase; protected: int id; @@ -422,7 +422,7 @@ }; class Edge { - friend class SmartUBipartiteGraphBase; + friend class SmartBpUGraphBase; protected: int id; @@ -435,33 +435,33 @@ bool operator<(const Edge i) const {return id 0) { - node.id = 2 * upperNodes.size() - 2; + if (aNodes.size() > 0) { + node.id = 2 * aNodes.size() - 2; } else { - node.id = 2 * lowerNodes.size() - 1; + node.id = 2 * bNodes.size() - 1; } } void next(Node& node) const { node.id -= 2; if (node.id == -2) { - node.id = 2 * lowerNodes.size() - 1; + node.id = 2 * bNodes.size() - 1; } } @@ -472,20 +472,20 @@ --edge.id; } - void firstDown(Edge& edge, const Node& node) const { + void firstOut(Edge& edge, const Node& node) const { LEMON_ASSERT((node.id & 1) == 0, NodeSetError()); - edge.id = upperNodes[node.id >> 1].first; + edge.id = aNodes[node.id >> 1].first; } - void nextDown(Edge& edge) const { - edge.id = edges[edge.id].next_down; + void nextOut(Edge& edge) const { + edge.id = edges[edge.id].next_out; } - void firstUp(Edge& edge, const Node& node) const { + void firstIn(Edge& edge, const Node& node) const { LEMON_ASSERT((node.id & 1) == 1, NodeSetError()); - edge.id = lowerNodes[node.id >> 1].first; + edge.id = bNodes[node.id >> 1].first; } - void nextUp(Edge& edge) const { - edge.id = edges[edge.id].next_up; + void nextIn(Edge& edge) const { + edge.id = edges[edge.id].next_in; } static int id(const Node& node) { @@ -495,8 +495,8 @@ return Node(id); } int maxNodeId() const { - return upperNodes.size() > lowerNodes.size() ? - upperNodes.size() * 2 - 2 : lowerNodes.size() * 2 - 1; + return aNodes.size() > bNodes.size() ? + aNodes.size() * 2 - 2 : bNodes.size() * 2 - 1; } static int id(const Edge& edge) { @@ -509,95 +509,103 @@ return edges.size(); } - static int upperId(const Node& node) { + static int aNodeId(const Node& node) { return node.id >> 1; } - static Node fromUpperId(int id, Node) { + static Node fromANodeId(int id, Node) { return Node(id << 1); } - int maxUpperId() const { - return upperNodes.size(); + int maxANodeId() const { + return aNodes.size(); } - static int lowerId(const Node& node) { + static int bNodeId(const Node& node) { return node.id >> 1; } - static Node fromLowerId(int id) { + static Node fromBNodeId(int id) { return Node((id << 1) + 1); } - int maxLowerId() const { - return lowerNodes.size(); + int maxBNodeId() const { + return bNodes.size(); } - Node upperNode(const Edge& edge) const { - return Node(edges[edge.id].upper); + Node aNode(const Edge& edge) const { + return Node(edges[edge.id].aNode); } - Node lowerNode(const Edge& edge) const { - return Node(edges[edge.id].lower); + Node bNode(const Edge& edge) const { + return Node(edges[edge.id].bNode); } - static bool upper(const Node& node) { + static bool aNode(const Node& node) { return (node.id & 1) == 0; } - static bool lower(const Node& node) { + static bool bNode(const Node& node) { return (node.id & 1) == 1; } - Node addUpperNode() { + Node addANode() { NodeT nodeT; nodeT.first = -1; - upperNodes.push_back(nodeT); - return Node(upperNodes.size() * 2 - 2); + aNodes.push_back(nodeT); + return Node(aNodes.size() * 2 - 2); } - Node addLowerNode() { + Node addBNode() { NodeT nodeT; nodeT.first = -1; - lowerNodes.push_back(nodeT); - return Node(lowerNodes.size() * 2 - 1); + bNodes.push_back(nodeT); + return Node(bNodes.size() * 2 - 1); } Edge addEdge(const Node& source, const Node& target) { LEMON_ASSERT(((source.id ^ target.id) & 1) == 1, NodeSetError()); EdgeT edgeT; if ((source.id & 1) == 0) { - edgeT.upper = source.id; - edgeT.lower = target.id; + edgeT.aNode = source.id; + edgeT.bNode = target.id; } else { - edgeT.upper = target.id; - edgeT.lower = source.id; + edgeT.aNode = target.id; + edgeT.bNode = source.id; } - edgeT.next_down = upperNodes[edgeT.upper >> 1].first; - upperNodes[edgeT.upper >> 1].first = edges.size(); - edgeT.next_up = lowerNodes[edgeT.lower >> 1].first; - lowerNodes[edgeT.lower >> 1].first = edges.size(); + edgeT.next_out = aNodes[edgeT.aNode >> 1].first; + aNodes[edgeT.aNode >> 1].first = edges.size(); + edgeT.next_in = bNodes[edgeT.bNode >> 1].first; + bNodes[edgeT.bNode >> 1].first = edges.size(); edges.push_back(edgeT); return Edge(edges.size() - 1); } void clear() { - upperNodes.clear(); - lowerNodes.clear(); + aNodes.clear(); + bNodes.clear(); edges.clear(); } }; - typedef ClearableUBipartiteGraphExtender< - ExtendableUBipartiteGraphExtender< - MappableUBipartiteGraphExtender< - IterableUBipartiteGraphExtender< - AlterableUBipartiteGraphExtender< - UBipartiteGraphExtender < - SmartUBipartiteGraphBase> > > > > > - ExtendedSmartUBipartiteGraphBase; + typedef ClearableBpUGraphExtender< + ExtendableBpUGraphExtender< + MappableBpUGraphExtender< + IterableBpUGraphExtender< + AlterableBpUGraphExtender< + BpUGraphExtender < + SmartBpUGraphBase> > > > > > + ExtendedSmartBpUGraphBase; - - class SmartUBipartiteGraph : - public ExtendedSmartUBipartiteGraphBase { - }; + /// \ingroup graphs + /// + /// \brief A smart bipartite undirected graph class. + /// + /// This is a simple and fast bipartite undirected graph implementation. + /// It is also quite memory efficient, but at the price + /// that it does not support node and edge deletions. + /// Except from this it conforms to + /// the \ref concept::BpUGraph "BpUGraph" concept. + /// \sa concept::BpUGraph. + /// + class SmartBpUGraph : public ExtendedSmartBpUGraphBase {}; /// @}