diff -r 4317d277ba21 -r 765619b7cbb2 lemon/concepts/graph_components.h --- a/lemon/concepts/graph_components.h Sun Jul 13 16:46:56 2008 +0100 +++ b/lemon/concepts/graph_components.h Sun Jul 13 19:51:02 2008 +0100 @@ -1,6 +1,6 @@ -/* -*- C++ -*- +/* -*- mode: C++; indent-tabs-mode: nil; -*- * - * This file is a part of LEMON, a generic C++ optimization library + * This file is a part of LEMON, a generic C++ optimization library. * * Copyright (C) 2003-2008 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport @@ -49,7 +49,7 @@ class GraphItem { public: /// \brief Default constructor. - /// + /// /// \warning The default constructor is not required to set /// the item to some well-defined value. So you should consider it /// as uninitialized. @@ -66,7 +66,7 @@ GraphItem(Invalid) {} /// \brief Assign operator for nodes. /// - /// The nodes are assignable. + /// The nodes are assignable. /// GraphItem& operator=(GraphItem const&) { return *this; } /// \brief Equality operator. @@ -92,27 +92,27 @@ template struct Constraints { - void constraints() { - _GraphItem i1; - _GraphItem i2 = i1; - _GraphItem i3 = INVALID; - - i1 = i2 = i3; + void constraints() { + _GraphItem i1; + _GraphItem i2 = i1; + _GraphItem i3 = INVALID; - bool b; - // b = (ia == ib) && (ia != ib) && (ia < ib); - b = (ia == ib) && (ia != ib); - b = (ia == INVALID) && (ib != INVALID); + i1 = i2 = i3; + + bool b; + // b = (ia == ib) && (ia != ib) && (ia < ib); + b = (ia == ib) && (ia != ib); + b = (ia == INVALID) && (ib != INVALID); b = (ia < ib); - } + } - const _GraphItem &ia; - const _GraphItem &ib; + const _GraphItem &ia; + const _GraphItem &ib; }; }; /// \brief An empty base directed graph class. - /// + /// /// This class provides the minimal set of features needed for a /// directed graph structure. All digraph concepts have to be /// conform to this base directed graph. It just provides types @@ -122,16 +122,16 @@ public: typedef BaseDigraphComponent Digraph; - + /// \brief Node class of the digraph. /// - /// This class represents the Nodes of the digraph. + /// This class represents the Nodes of the digraph. /// typedef GraphItem<'n'> Node; /// \brief Arc class of the digraph. /// - /// This class represents the Arcs of the digraph. + /// This class represents the Arcs of the digraph. /// typedef GraphItem<'e'> Arc; @@ -156,27 +156,27 @@ template struct Constraints { - typedef typename _Digraph::Node Node; - typedef typename _Digraph::Arc Arc; - - void constraints() { - checkConcept, Node>(); - checkConcept, Arc>(); - { - Node n; - Arc e(INVALID); - n = digraph.source(e); - n = digraph.target(e); + typedef typename _Digraph::Node Node; + typedef typename _Digraph::Arc Arc; + + void constraints() { + checkConcept, Node>(); + checkConcept, Arc>(); + { + Node n; + Arc e(INVALID); + n = digraph.source(e); + n = digraph.target(e); n = digraph.oppositeNode(n, e); - } - } - - const _Digraph& digraph; + } + } + + const _Digraph& digraph; }; }; /// \brief An empty base undirected graph class. - /// + /// /// This class provides the minimal set of features needed for an /// undirected graph structure. All undirected graph concepts have /// to be conform to this base graph. It just provides types for @@ -199,7 +199,7 @@ public: typedef GraphItem<'u'> Parent; /// \brief Default constructor. - /// + /// /// \warning The default constructor is not required to set /// the item to some well-defined value. So you should consider it /// as uninitialized. @@ -217,12 +217,12 @@ /// \brief Converter from arc to edge. /// /// Besides the core graph item functionality each arc should - /// be convertible to the represented edge. + /// be convertible to the represented edge. Edge(const Arc&) {} /// \brief Assign arc to edge. /// /// Besides the core graph item functionality each arc should - /// be convertible to the represented edge. + /// be convertible to the represented edge. Edge& operator=(const Arc&) { return *this; } }; @@ -237,13 +237,13 @@ /// /// Returns the directed arc from its direction and the /// represented edge. - Arc direct(const Edge&, bool) const { return INVALID;} + Arc direct(const Edge&, bool) const { return INVALID;} /// \brief Returns the directed arc. /// /// Returns the directed arc from its source and the /// represented edge. - Arc direct(const Edge&, const Node&) const { return INVALID;} + Arc direct(const Edge&, const Node&) const { return INVALID;} /// \brief Returns the opposite arc. /// @@ -260,38 +260,38 @@ /// /// Gives back the other ending of an edge. Node v(const Edge&) const { return INVALID;} - + template struct Constraints { - typedef typename _Graph::Node Node; - typedef typename _Graph::Arc Arc; - typedef typename _Graph::Edge Edge; - - void constraints() { + typedef typename _Graph::Node Node; + typedef typename _Graph::Arc Arc; + typedef typename _Graph::Edge Edge; + + void constraints() { checkConcept(); - checkConcept, Edge>(); - { - Node n; - Edge ue(INVALID); + checkConcept, Edge>(); + { + Node n; + Edge ue(INVALID); Arc e; - n = graph.u(ue); - n = graph.v(ue); + n = graph.u(ue); + n = graph.v(ue); e = graph.direct(ue, true); e = graph.direct(ue, n); e = graph.oppositeArc(e); ue = e; bool d = graph.direction(e); ignore_unused_variable_warning(d); - } - } - - const _Graph& graph; + } + } + + const _Graph& graph; }; }; /// \brief An empty idable base digraph class. - /// + /// /// This class provides beside the core digraph features /// core id functions for the digraph structure. /// The most of the base digraphs should be conform to this concept. @@ -304,9 +304,9 @@ typedef typename Base::Node Node; typedef typename Base::Arc Arc; - /// \brief Gives back an unique integer id for the Node. + /// \brief Gives back an unique integer id for the Node. /// - /// Gives back an unique integer id for the Node. + /// Gives back an unique integer id for the Node. /// int id(const Node&) const { return -1;} @@ -314,12 +314,12 @@ /// /// Gives back the node by the unique id. /// If the digraph does not contain node with the given id - /// then the result of the function is undetermined. + /// then the result of the function is undetermined. Node nodeFromId(int) const { return INVALID;} - /// \brief Gives back an unique integer id for the Arc. + /// \brief Gives back an unique integer id for the Arc. /// - /// Gives back an unique integer id for the Arc. + /// Gives back an unique integer id for the Arc. /// int id(const Arc&) const { return -1;} @@ -327,7 +327,7 @@ /// /// Gives back the arc by the unique id. /// If the digraph does not contain arc with the given id - /// then the result of the function is undetermined. + /// then the result of the function is undetermined. Arc arcFromId(int) const { return INVALID;} /// \brief Gives back an integer greater or equal to the maximum @@ -347,29 +347,29 @@ template struct Constraints { - void constraints() { - checkConcept(); - typename _Digraph::Node node; - int nid = digraph.id(node); - nid = digraph.id(node); - node = digraph.nodeFromId(nid); - typename _Digraph::Arc arc; - int eid = digraph.id(arc); - eid = digraph.id(arc); - arc = digraph.arcFromId(eid); + void constraints() { + checkConcept(); + typename _Digraph::Node node; + int nid = digraph.id(node); + nid = digraph.id(node); + node = digraph.nodeFromId(nid); + typename _Digraph::Arc arc; + int eid = digraph.id(arc); + eid = digraph.id(arc); + arc = digraph.arcFromId(eid); - nid = digraph.maxNodeId(); - ignore_unused_variable_warning(nid); - eid = digraph.maxArcId(); - ignore_unused_variable_warning(eid); - } + nid = digraph.maxNodeId(); + ignore_unused_variable_warning(nid); + eid = digraph.maxArcId(); + ignore_unused_variable_warning(eid); + } - const _Digraph& digraph; + const _Digraph& digraph; }; }; /// \brief An empty idable base undirected graph class. - /// + /// /// This class provides beside the core undirected graph features /// core id functions for the undirected graph structure. The /// most of the base undirected graphs should be conform to this @@ -383,9 +383,9 @@ using IDableDigraphComponent<_Base>::id; - /// \brief Gives back an unique integer id for the Edge. + /// \brief Gives back an unique integer id for the Edge. /// - /// Gives back an unique integer id for the Edge. + /// Gives back an unique integer id for the Edge. /// int id(const Edge&) const { return -1;} @@ -406,18 +406,18 @@ template struct Constraints { - void constraints() { - checkConcept(); - checkConcept, _Graph >(); - typename _Graph::Edge edge; - int ueid = graph.id(edge); - ueid = graph.id(edge); - edge = graph.edgeFromId(ueid); - ueid = graph.maxEdgeId(); - ignore_unused_variable_warning(ueid); - } + void constraints() { + checkConcept(); + checkConcept, _Graph >(); + typename _Graph::Edge edge; + int ueid = graph.id(edge); + ueid = graph.id(edge); + edge = graph.edgeFromId(ueid); + ueid = graph.maxEdgeId(); + ignore_unused_variable_warning(ueid); + } - const _Graph& graph; + const _Graph& graph; }; }; @@ -450,52 +450,52 @@ GraphItemIt(Invalid) {} /// \brief Assign operator for items. /// - /// The items are assignable. + /// The items are assignable. /// - GraphItemIt& operator=(const GraphItemIt&) { return *this; } + GraphItemIt& operator=(const GraphItemIt&) { return *this; } /// \brief Next item. - /// + /// /// Assign the iterator to the next item. /// GraphItemIt& operator++() { return *this; } /// \brief Equality operator - /// + /// /// Two iterators are equal if and only if they point to the /// same object or both are invalid. bool operator==(const GraphItemIt&) const { return true;} /// \brief Inequality operator - /// + /// /// \sa operator==(Node n) /// bool operator!=(const GraphItemIt&) const { return true;} - + template struct Constraints { - void constraints() { - _GraphItemIt it1(g); - _GraphItemIt it2; + void constraints() { + _GraphItemIt it1(g); + _GraphItemIt it2; - it2 = ++it1; - ++it2 = it1; - ++(++it1); + it2 = ++it1; + ++it2 = it1; + ++(++it1); - _Item bi = it1; - bi = it2; - } - _Graph& g; + _Item bi = it1; + bi = it2; + } + _Graph& g; }; }; /// \brief Skeleton class for graph InArcIt and OutArcIt /// /// \note Because InArcIt and OutArcIt may not inherit from the same - /// base class, the _selector is a additional template parameter. For - /// InArcIt you should instantiate it with character 'i' and for + /// base class, the _selector is a additional template parameter. For + /// InArcIt you should instantiate it with character 'i' and for /// OutArcIt with 'o'. template + typename _Item = typename _Graph::Arc, + typename _Base = typename _Graph::Node, + char _selector = '0'> class GraphIncIt : public _Item { public: /// \brief Default constructor. @@ -508,10 +508,10 @@ /// Copy constructor. /// GraphIncIt(GraphIncIt const& gi) : _Item(gi) {} - /// \brief Sets the iterator to the first arc incoming into or outgoing + /// \brief Sets the iterator to the first arc incoming into or outgoing /// from the node. /// - /// Sets the iterator to the first arc incoming into or outgoing + /// Sets the iterator to the first arc incoming into or outgoing /// from the node. /// explicit GraphIncIt(const _Graph&, const _Base&) {} @@ -522,9 +522,9 @@ GraphIncIt(Invalid) {} /// \brief Assign operator for iterators. /// - /// The iterators are assignable. + /// The iterators are assignable. /// - GraphIncIt& operator=(GraphIncIt const&) { return *this; } + GraphIncIt& operator=(GraphIncIt const&) { return *this; } /// \brief Next item. /// /// Assign the iterator to the next item. @@ -545,23 +545,23 @@ template struct Constraints { - void constraints() { - checkConcept, _GraphIncIt>(); - _GraphIncIt it1(graph, node); - _GraphIncIt it2; + void constraints() { + checkConcept, _GraphIncIt>(); + _GraphIncIt it1(graph, node); + _GraphIncIt it2; - it2 = ++it1; - ++it2 = it1; - ++(++it1); - _Item e = it1; - e = it2; + it2 = ++it1; + ++it2 = it1; + ++(++it1); + _Item e = it1; + e = it2; - } + } - _Item arc; - _Base node; - _Graph graph; - _GraphIncIt it; + _Item arc; + _Base node; + _Graph graph; + _GraphIncIt it; }; }; @@ -575,7 +575,7 @@ class IterableDigraphComponent : public _Base { public: - + typedef _Base Base; typedef typename Base::Node Node; typedef typename Base::Arc Arc; @@ -583,33 +583,33 @@ typedef IterableDigraphComponent Digraph; /// \name Base iteration - /// + /// /// This interface provides functions for iteration on digraph items /// - /// @{ + /// @{ /// \brief Gives back the first node in the iterating order. - /// + /// /// Gives back the first node in the iterating order. - /// + /// void first(Node&) const {} /// \brief Gives back the next node in the iterating order. /// /// Gives back the next node in the iterating order. - /// + /// void next(Node&) const {} /// \brief Gives back the first arc in the iterating order. /// /// Gives back the first arc in the iterating order. - /// + /// void first(Arc&) const {} /// \brief Gives back the next arc in the iterating order. /// /// Gives back the next arc in the iterating order. - /// + /// void next(Arc&) const {} @@ -617,7 +617,7 @@ /// node. /// /// Gives back the first of the arcs point to the given node. - /// + /// void firstIn(Arc&, const Node&) const {} /// \brief Gives back the next of the arcs points to the given @@ -629,22 +629,22 @@ /// \brief Gives back the first of the arcs start from the /// given node. - /// + /// /// Gives back the first of the arcs start from the given node. - /// + /// void firstOut(Arc&, const Node&) const {} /// \brief Gives back the next of the arcs start from the given /// node. /// /// Gives back the next of the arcs start from the given node. - /// + /// void nextOut(Arc&) const {} /// @} /// \name Class based iteration - /// + /// /// This interface provides functions for iteration on digraph items /// /// @{ @@ -699,13 +699,13 @@ /// @} - template + template struct Constraints { - void constraints() { - checkConcept(); + void constraints() { + checkConcept(); { - typename _Digraph::Node node(INVALID); + typename _Digraph::Node node(INVALID); typename _Digraph::Arc arc(INVALID); { digraph.first(node); @@ -723,16 +723,16 @@ digraph.firstOut(arc, node); digraph.nextOut(arc); } - } + } { checkConcept, typename _Digraph::ArcIt >(); checkConcept, typename _Digraph::NodeIt >(); - checkConcept, typename _Digraph::InArcIt>(); - checkConcept, typename _Digraph::OutArcIt>(); typename _Digraph::Node n; @@ -745,9 +745,9 @@ ignore_unused_variable_warning(n); } } - - const _Digraph& digraph; - + + const _Digraph& digraph; + }; }; @@ -765,13 +765,13 @@ typedef typename Base::Arc Arc; typedef typename Base::Edge Edge; - + typedef IterableGraphComponent Graph; /// \name Base iteration - /// + /// /// This interface provides functions for iteration on graph items - /// @{ + /// @{ using IterableDigraphComponent<_Base>::first; using IterableDigraphComponent<_Base>::next; @@ -780,14 +780,14 @@ /// order. /// /// Gives back the first edge in the iterating order. - /// + /// void first(Edge&) const {} /// \brief Gives back the next edge in the iterating /// order. /// /// Gives back the next edge in the iterating order. - /// + /// void next(Edge&) const {} @@ -814,7 +814,7 @@ /// @} /// \name Class based iteration - /// + /// /// This interface provides functions for iteration on graph items /// /// @{ @@ -841,10 +841,10 @@ /// @} - template + template struct Constraints { - void constraints() { - checkConcept, _Graph>(); + void constraints() { + checkConcept, _Graph>(); { typename _Graph::Node node(INVALID); @@ -858,29 +858,29 @@ graph.firstInc(edge, dir, node); graph.nextInc(edge, dir); } - - } - + + } + { checkConcept, typename _Graph::EdgeIt >(); - checkConcept, typename _Graph::IncEdgeIt>(); - + typename _Graph::Node n; typename _Graph::IncEdgeIt ueit(INVALID); n = graph.baseNode(ueit); n = graph.runningNode(ueit); } } - - const _Graph& graph; - + + const _Graph& graph; + }; }; /// \brief An empty alteration notifier digraph class. - /// + /// /// This class provides beside the core digraph features alteration /// notifier interface for the digraph structure. This implements /// an observer-notifier pattern for each digraph item. More @@ -897,48 +897,48 @@ /// The node observer registry. - typedef AlterationNotifier + typedef AlterationNotifier NodeNotifier; /// The arc observer registry. - typedef AlterationNotifier + typedef AlterationNotifier ArcNotifier; - + /// \brief Gives back the node alteration notifier. /// /// Gives back the node alteration notifier. NodeNotifier& notifier(Node) const { - return NodeNotifier(); + return NodeNotifier(); } - + /// \brief Gives back the arc alteration notifier. /// /// Gives back the arc alteration notifier. ArcNotifier& notifier(Arc) const { - return ArcNotifier(); + return ArcNotifier(); } - template + template struct Constraints { - void constraints() { - checkConcept(); - typename _Digraph::NodeNotifier& nn + void constraints() { + checkConcept(); + typename _Digraph::NodeNotifier& nn = digraph.notifier(typename _Digraph::Node()); - typename _Digraph::ArcNotifier& en + typename _Digraph::ArcNotifier& en = digraph.notifier(typename _Digraph::Arc()); - + ignore_unused_variable_warning(nn); ignore_unused_variable_warning(en); - } - - const _Digraph& digraph; - + } + + const _Digraph& digraph; + }; - + }; /// \brief An empty alteration notifier undirected graph class. - /// + /// /// This class provides beside the core graph features alteration /// notifier interface for the graph structure. This implements /// an observer-notifier pattern for each graph item. More @@ -954,33 +954,33 @@ /// The arc observer registry. - typedef AlterationNotifier + typedef AlterationNotifier EdgeNotifier; - + /// \brief Gives back the arc alteration notifier. /// /// Gives back the arc alteration notifier. EdgeNotifier& notifier(Edge) const { - return EdgeNotifier(); + return EdgeNotifier(); } - template + template struct Constraints { - void constraints() { - checkConcept, _Graph>(); - typename _Graph::EdgeNotifier& uen + void constraints() { + checkConcept, _Graph>(); + typename _Graph::EdgeNotifier& uen = graph.notifier(typename _Graph::Edge()); ignore_unused_variable_warning(uen); - } - - const _Graph& graph; - + } + + const _Graph& graph; + }; - + }; /// \brief Class describing the concept of graph maps - /// + /// /// This class describes the common interface of the graph maps /// (NodeMap, ArcMap), that is \ref maps-page "maps" which can be used to /// associate data to graph descriptors (nodes or arcs). @@ -1009,39 +1009,39 @@ /// /// Copy Constructor. GraphMap(const GraphMap&) : Parent() {} - + /// \brief Assign operator. /// /// Assign operator. It does not mofify the underlying graph, /// it just iterates on the current item set and set the map - /// with the value returned by the assigned map. + /// with the value returned by the assigned map. template - GraphMap& operator=(const CMap&) { + GraphMap& operator=(const CMap&) { checkConcept, CMap>(); return *this; } template struct Constraints { - void constraints() { - checkConcept, _Map >(); - // Construction with a graph parameter - _Map a(g); - // Constructor with a graph and a default value parameter - _Map a2(g,t); - // Copy constructor. - _Map b(c); - + void constraints() { + checkConcept, _Map >(); + // Construction with a graph parameter + _Map a(g); + // Constructor with a graph and a default value parameter + _Map a2(g,t); + // Copy constructor. + _Map b(c); + ReadMap cmap; b = cmap; - ignore_unused_variable_warning(a2); - ignore_unused_variable_warning(b); - } + ignore_unused_variable_warning(a2); + ignore_unused_variable_warning(b); + } - const _Map &c; - const Graph &g; - const typename GraphMap::Value &t; + const _Map &c; + const Graph &g; + const typename GraphMap::Value &t; }; }; @@ -1070,28 +1070,28 @@ public: typedef GraphMap Parent; - /// \brief Construct a new map. - /// - /// Construct a new map for the digraph. - explicit NodeMap(const MappableDigraphComponent& digraph) + /// \brief Construct a new map. + /// + /// Construct a new map for the digraph. + explicit NodeMap(const MappableDigraphComponent& digraph) : Parent(digraph) {} - /// \brief Construct a new map with default value. - /// - /// Construct a new map for the digraph and initalise the values. - NodeMap(const MappableDigraphComponent& digraph, const _Value& value) + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the digraph and initalise the values. + NodeMap(const MappableDigraphComponent& digraph, const _Value& value) : Parent(digraph, value) {} - /// \brief Copy constructor. - /// - /// Copy Constructor. - NodeMap(const NodeMap& nm) : Parent(nm) {} + /// \brief Copy constructor. + /// + /// Copy Constructor. + NodeMap(const NodeMap& nm) : Parent(nm) {} - /// \brief Assign operator. - /// - /// Assign operator. + /// \brief Assign operator. + /// + /// Assign operator. template - NodeMap& operator=(const CMap&) { + NodeMap& operator=(const CMap&) { checkConcept, CMap>(); return *this; } @@ -1107,28 +1107,28 @@ public: typedef GraphMap Parent; - /// \brief Construct a new map. - /// - /// Construct a new map for the digraph. - explicit ArcMap(const MappableDigraphComponent& digraph) + /// \brief Construct a new map. + /// + /// Construct a new map for the digraph. + explicit ArcMap(const MappableDigraphComponent& digraph) : Parent(digraph) {} - /// \brief Construct a new map with default value. - /// - /// Construct a new map for the digraph and initalise the values. - ArcMap(const MappableDigraphComponent& digraph, const _Value& value) + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the digraph and initalise the values. + ArcMap(const MappableDigraphComponent& digraph, const _Value& value) : Parent(digraph, value) {} - /// \brief Copy constructor. - /// - /// Copy Constructor. - ArcMap(const ArcMap& nm) : Parent(nm) {} + /// \brief Copy constructor. + /// + /// Copy Constructor. + ArcMap(const ArcMap& nm) : Parent(nm) {} - /// \brief Assign operator. - /// - /// Assign operator. + /// \brief Assign operator. + /// + /// Assign operator. template - ArcMap& operator=(const CMap&) { + ArcMap& operator=(const CMap&) { checkConcept, CMap>(); return *this; } @@ -1139,44 +1139,44 @@ template struct Constraints { - struct Dummy { - int value; - Dummy() : value(0) {} - Dummy(int _v) : value(_v) {} - }; + struct Dummy { + int value; + Dummy() : value(0) {} + Dummy(int _v) : value(_v) {} + }; - void constraints() { - checkConcept(); - { // int map test - typedef typename _Digraph::template NodeMap IntNodeMap; - checkConcept, - IntNodeMap >(); - } { // bool map test - typedef typename _Digraph::template NodeMap BoolNodeMap; - checkConcept, - BoolNodeMap >(); - } { // Dummy map test - typedef typename _Digraph::template NodeMap DummyNodeMap; - checkConcept, - DummyNodeMap >(); - } + void constraints() { + checkConcept(); + { // int map test + typedef typename _Digraph::template NodeMap IntNodeMap; + checkConcept, + IntNodeMap >(); + } { // bool map test + typedef typename _Digraph::template NodeMap BoolNodeMap; + checkConcept, + BoolNodeMap >(); + } { // Dummy map test + typedef typename _Digraph::template NodeMap DummyNodeMap; + checkConcept, + DummyNodeMap >(); + } - { // int map test - typedef typename _Digraph::template ArcMap IntArcMap; - checkConcept, - IntArcMap >(); - } { // bool map test - typedef typename _Digraph::template ArcMap BoolArcMap; - checkConcept, - BoolArcMap >(); - } { // Dummy map test - typedef typename _Digraph::template ArcMap DummyArcMap; - checkConcept, - DummyArcMap >(); - } - } + { // int map test + typedef typename _Digraph::template ArcMap IntArcMap; + checkConcept, + IntArcMap >(); + } { // bool map test + typedef typename _Digraph::template ArcMap BoolArcMap; + checkConcept, + BoolArcMap >(); + } { // Dummy map test + typedef typename _Digraph::template ArcMap DummyArcMap; + checkConcept, + DummyArcMap >(); + } + } - _Digraph& digraph; + _Digraph& digraph; }; }; @@ -1199,32 +1199,32 @@ /// ReadWrite map of the edges. /// template - class EdgeMap : public GraphMap { + class EdgeMap : public GraphMap { public: typedef GraphMap Parent; - /// \brief Construct a new map. - /// - /// Construct a new map for the graph. - explicit EdgeMap(const MappableGraphComponent& graph) + /// \brief Construct a new map. + /// + /// Construct a new map for the graph. + explicit EdgeMap(const MappableGraphComponent& graph) : Parent(graph) {} - /// \brief Construct a new map with default value. - /// - /// Construct a new map for the graph and initalise the values. - EdgeMap(const MappableGraphComponent& graph, const _Value& value) + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the graph and initalise the values. + EdgeMap(const MappableGraphComponent& graph, const _Value& value) : Parent(graph, value) {} - /// \brief Copy constructor. - /// - /// Copy Constructor. - EdgeMap(const EdgeMap& nm) : Parent(nm) {} + /// \brief Copy constructor. + /// + /// Copy Constructor. + EdgeMap(const EdgeMap& nm) : Parent(nm) {} - /// \brief Assign operator. - /// - /// Assign operator. + /// \brief Assign operator. + /// + /// Assign operator. template - EdgeMap& operator=(const CMap&) { + EdgeMap& operator=(const CMap&) { checkConcept, CMap>(); return *this; } @@ -1235,31 +1235,31 @@ template struct Constraints { - struct Dummy { - int value; - Dummy() : value(0) {} - Dummy(int _v) : value(_v) {} - }; + struct Dummy { + int value; + Dummy() : value(0) {} + Dummy(int _v) : value(_v) {} + }; - void constraints() { - checkConcept, _Graph>(); + void constraints() { + checkConcept, _Graph>(); - { // int map test - typedef typename _Graph::template EdgeMap IntEdgeMap; - checkConcept, - IntEdgeMap >(); - } { // bool map test - typedef typename _Graph::template EdgeMap BoolEdgeMap; - checkConcept, - BoolEdgeMap >(); - } { // Dummy map test - typedef typename _Graph::template EdgeMap DummyEdgeMap; - checkConcept, - DummyEdgeMap >(); - } - } + { // int map test + typedef typename _Graph::template EdgeMap IntEdgeMap; + checkConcept, + IntEdgeMap >(); + } { // bool map test + typedef typename _Graph::template EdgeMap BoolEdgeMap; + checkConcept, + BoolEdgeMap >(); + } { // Dummy map test + typedef typename _Graph::template EdgeMap DummyEdgeMap; + checkConcept, + DummyEdgeMap >(); + } + } - _Graph& graph; + _Graph& graph; }; }; @@ -1282,28 +1282,28 @@ /// Adds a new node to the digraph. /// Node addNode() { - return INVALID; + return INVALID; } - + /// \brief Adds a new arc connects the given two nodes. /// /// Adds a new arc connects the the given two nodes. Arc addArc(const Node&, const Node&) { - return INVALID; + return INVALID; } template struct Constraints { - void constraints() { + void constraints() { checkConcept(); - typename _Digraph::Node node_a, node_b; - node_a = digraph.addNode(); - node_b = digraph.addNode(); - typename _Digraph::Arc arc; - arc = digraph.addArc(node_a, node_b); - } + typename _Digraph::Node node_a, node_b; + node_a = digraph.addNode(); + node_b = digraph.addNode(); + typename _Digraph::Arc arc; + arc = digraph.addArc(node_a, node_b); + } - _Digraph& digraph; + _Digraph& digraph; }; }; @@ -1327,33 +1327,33 @@ /// Adds a new node to the graph. /// Node addNode() { - return INVALID; + return INVALID; } - + /// \brief Adds a new arc connects the given two nodes. /// /// Adds a new arc connects the the given two nodes. Edge addArc(const Node&, const Node&) { - return INVALID; + return INVALID; } template struct Constraints { - void constraints() { - checkConcept(); - typename _Graph::Node node_a, node_b; - node_a = graph.addNode(); - node_b = graph.addNode(); - typename _Graph::Edge edge; - edge = graph.addEdge(node_a, node_b); - } + void constraints() { + checkConcept(); + typename _Graph::Node node_a, node_b; + node_a = graph.addNode(); + node_b = graph.addNode(); + typename _Graph::Edge edge; + edge = graph.addEdge(node_a, node_b); + } - _Graph& graph; + _Graph& graph; }; }; /// \brief An empty erasable digraph class. - /// + /// /// This class provides beside the core digraph features core erase /// functions for the digraph structure. The main difference between /// the base and this interface is that the digraph alterations @@ -1368,9 +1368,9 @@ /// \brief Erase a node from the digraph. /// - /// Erase a node from the digraph. This function should + /// Erase a node from the digraph. This function should /// erase all arcs connecting to the node. - void erase(const Node&) {} + void erase(const Node&) {} /// \brief Erase an arc from the digraph. /// @@ -1380,20 +1380,20 @@ template struct Constraints { - void constraints() { + void constraints() { checkConcept(); - typename _Digraph::Node node; - digraph.erase(node); - typename _Digraph::Arc arc; - digraph.erase(arc); - } + typename _Digraph::Node node; + digraph.erase(node); + typename _Digraph::Arc arc; + digraph.erase(arc); + } - _Digraph& digraph; + _Digraph& digraph; }; }; /// \brief An empty erasable base undirected graph class. - /// + /// /// This class provides beside the core undirected graph features /// core erase functions for the undirceted graph structure. The /// main difference between the base and this interface is that @@ -1410,7 +1410,7 @@ /// /// Erase a node from the graph. This function should erase /// arcs connecting to the node. - void erase(const Node&) {} + void erase(const Node&) {} /// \brief Erase an arc from the graph. /// @@ -1420,15 +1420,15 @@ template struct Constraints { - void constraints() { + void constraints() { checkConcept(); - typename _Graph::Node node; - graph.erase(node); - typename _Graph::Edge edge; - graph.erase(edge); - } + typename _Graph::Node node; + graph.erase(node); + typename _Graph::Edge edge; + graph.erase(edge); + } - _Graph& graph; + _Graph& graph; }; }; @@ -1448,16 +1448,16 @@ /// /// Erase all nodes and arcs from the digraph. /// - void clear() {} + void clear() {} template struct Constraints { - void constraints() { + void constraints() { checkConcept(); - digraph.clear(); - } + digraph.clear(); + } - _Digraph digraph; + _Digraph digraph; }; }; @@ -1475,11 +1475,11 @@ template struct Constraints { - void constraints() { + void constraints() { checkConcept, _Graph>(); - } + } - _Graph graph; + _Graph graph; }; };