COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
03/29/09 23:08:20 (15 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Various doc improvements (#248)

  • Rename all the ugly template parameters (too long and/or starting with an underscore).
  • Rename function parameters starting with an underscore.
  • Extend the doc for many classes.
  • Use LaTeX-style O(...) expressions only for the complicated ones.
  • A lot of small unification changes.
  • Small fixes.
  • Some other improvements.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/concepts/graph_components.h

    r581 r606  
    2121///\brief The concept of graph components.
    2222
    23 
    2423#ifndef LEMON_CONCEPTS_GRAPH_COMPONENTS_H
    2524#define LEMON_CONCEPTS_GRAPH_COMPONENTS_H
     
    4544
    4645#ifndef DOXYGEN
    47     template <char _selector = '0'>
     46    template <char sel = '0'>
    4847#endif
    4948    class GraphItem {
     
    297296    /// The most of the base digraphs should conform to this concept.
    298297    /// The id's are unique and immutable.
    299     template <typename _Base = BaseDigraphComponent>
    300     class IDableDigraphComponent : public _Base {
    301     public:
    302 
    303       typedef _Base Base;
     298    template <typename BAS = BaseDigraphComponent>
     299    class IDableDigraphComponent : public BAS {
     300    public:
     301
     302      typedef BAS Base;
    304303      typedef typename Base::Node Node;
    305304      typedef typename Base::Arc Arc;
     
    375374    /// most of the base undirected graphs should conform to this
    376375    /// concept.  The id's are unique and immutable.
    377     template <typename _Base = BaseGraphComponent>
    378     class IDableGraphComponent : public IDableDigraphComponent<_Base> {
    379     public:
    380 
    381       typedef _Base Base;
     376    template <typename BAS = BaseGraphComponent>
     377    class IDableGraphComponent : public IDableDigraphComponent<BAS> {
     378    public:
     379
     380      typedef BAS Base;
    382381      typedef typename Base::Edge Edge;
    383382
    384       using IDableDigraphComponent<_Base>::id;
     383      using IDableDigraphComponent<Base>::id;
    385384
    386385      /// \brief Gives back an unique integer id for the Edge.
     
    426425    /// Skeleton class for graph NodeIt and ArcIt.
    427426    ///
    428     template <typename _Graph, typename _Item>
    429     class GraphItemIt : public _Item {
     427    template <typename GR, typename Item>
     428    class GraphItemIt : public Item {
    430429    public:
    431430      /// \brief Default constructor.
     
    443442      /// Sets the iterator to the first item of \c the graph.
    444443      ///
    445       explicit GraphItemIt(const _Graph&) {}
     444      explicit GraphItemIt(const GR&) {}
    446445      /// \brief Invalid constructor \& conversion.
    447446      ///
     
    480479          ++(++it1);
    481480
    482           _Item bi = it1;
     481          Item bi = it1;
    483482          bi = it2;
    484483        }
    485         _Graph& g;
     484        GR& g;
    486485      };
    487486    };
     
    490489    ///
    491490    /// \note Because InArcIt and OutArcIt may not inherit from the same
    492     /// base class, the _selector is a additional template parameter. For
    493     /// InArcIt you should instantiate it with character 'i' and for
     491    /// base class, the \c sel is a additional template parameter (selector).
     492    /// For InArcIt you should instantiate it with character 'i' and for
    494493    /// OutArcIt with 'o'.
    495     template <typename _Graph,
    496               typename _Item = typename _Graph::Arc,
    497               typename _Base = typename _Graph::Node,
    498               char _selector = '0'>
    499     class GraphIncIt : public _Item {
     494    template <typename GR,
     495              typename Item = typename GR::Arc,
     496              typename Base = typename GR::Node,
     497              char sel = '0'>
     498    class GraphIncIt : public Item {
    500499    public:
    501500      /// \brief Default constructor.
     
    508507      /// Copy constructor.
    509508      ///
    510       GraphIncIt(GraphIncIt const& gi) : _Item(gi) {}
     509      GraphIncIt(GraphIncIt const& gi) : Item(gi) {}
    511510      /// \brief Sets the iterator to the first arc incoming into or outgoing
    512511      /// from the node.
     
    515514      /// from the node.
    516515      ///
    517       explicit GraphIncIt(const _Graph&, const _Base&) {}
     516      explicit GraphIncIt(const GR&, const Base&) {}
    518517      /// \brief Invalid constructor \& conversion.
    519518      ///
     
    547546      struct Constraints {
    548547        void constraints() {
    549           checkConcept<GraphItem<_selector>, _GraphIncIt>();
     548          checkConcept<GraphItem<sel>, _GraphIncIt>();
    550549          _GraphIncIt it1(graph, node);
    551550          _GraphIncIt it2;
     
    554553          ++it2 = it1;
    555554          ++(++it1);
    556           _Item e = it1;
     555          Item e = it1;
    557556          e = it2;
    558557
    559558        }
    560559
    561         _Item arc;
    562         _Base node;
    563         _Graph graph;
     560        Item arc;
     561        Base node;
     562        GR graph;
    564563        _GraphIncIt it;
    565564      };
     
    572571    /// iterator based iterable interface for the digraph structure.
    573572    /// This concept is part of the Digraph concept.
    574     template <typename _Base = BaseDigraphComponent>
    575     class IterableDigraphComponent : public _Base {
    576 
    577     public:
    578 
    579       typedef _Base Base;
     573    template <typename BAS = BaseDigraphComponent>
     574    class IterableDigraphComponent : public BAS {
     575
     576    public:
     577
     578      typedef BAS Base;
    580579      typedef typename Base::Node Node;
    581580      typedef typename Base::Arc Arc;
     
    757756    /// based iterable interface for the undirected graph structure.
    758757    /// This concept is part of the Graph concept.
    759     template <typename _Base = BaseGraphComponent>
    760     class IterableGraphComponent : public IterableDigraphComponent<_Base> {
    761     public:
    762 
    763       typedef _Base Base;
     758    template <typename BAS = BaseGraphComponent>
     759    class IterableGraphComponent : public IterableDigraphComponent<BAS> {
     760    public:
     761
     762      typedef BAS Base;
    764763      typedef typename Base::Node Node;
    765764      typedef typename Base::Arc Arc;
     
    774773      /// @{
    775774
    776       using IterableDigraphComponent<_Base>::first;
    777       using IterableDigraphComponent<_Base>::next;
     775      using IterableDigraphComponent<Base>::first;
     776      using IterableDigraphComponent<Base>::next;
    778777
    779778      /// \brief Gives back the first edge in the iterating
     
    809808      void nextInc(Edge&, bool&) const {}
    810809
    811       using IterableDigraphComponent<_Base>::baseNode;
    812       using IterableDigraphComponent<_Base>::runningNode;
     810      using IterableDigraphComponent<Base>::baseNode;
     811      using IterableDigraphComponent<Base>::runningNode;
    813812
    814813      /// @}
     
    876875
    877876        const _Graph& graph;
    878 
    879877      };
    880878    };
     
    888886    /// alteration occured in the digraph all the observers will
    889887    /// notified about it.
    890     template <typename _Base = BaseDigraphComponent>
    891     class AlterableDigraphComponent : public _Base {
    892     public:
    893 
    894       typedef _Base Base;
     888    template <typename BAS = BaseDigraphComponent>
     889    class AlterableDigraphComponent : public BAS {
     890    public:
     891
     892      typedef BAS Base;
    895893      typedef typename Base::Node Node;
    896894      typedef typename Base::Arc Arc;
     
    946944    /// alteration occured in the graph all the observers will
    947945    /// notified about it.
    948     template <typename _Base = BaseGraphComponent>
    949     class AlterableGraphComponent : public AlterableDigraphComponent<_Base> {
    950     public:
    951 
    952       typedef _Base Base;
     946    template <typename BAS = BaseGraphComponent>
     947    class AlterableGraphComponent : public AlterableDigraphComponent<BAS> {
     948    public:
     949
     950      typedef BAS Base;
    953951      typedef typename Base::Edge Edge;
    954952
     
    975973
    976974        const _Graph& graph;
    977 
    978       };
    979 
     975      };
    980976    };
    981977
     
    985981    /// (NodeMap, ArcMap), that is maps that can be used to
    986982    /// associate data to graph descriptors (nodes or arcs).
    987     template <typename _Graph, typename _Item, typename _Value>
    988     class GraphMap : public ReadWriteMap<_Item, _Value> {
    989     public:
    990 
    991       typedef ReadWriteMap<_Item, _Value> Parent;
     983    template <typename GR, typename K, typename V>
     984    class GraphMap : public ReadWriteMap<K, V> {
     985    public:
     986
     987      typedef ReadWriteMap<K, V> Parent;
    992988
    993989      /// The graph type of the map.
    994       typedef _Graph Graph;
     990      typedef GR Graph;
    995991      /// The key type of the map.
    996       typedef _Item Key;
     992      typedef K Key;
    997993      /// The value type of the map.
    998       typedef _Value Value;
     994      typedef V Value;
    999995
    1000996      /// \brief Construct a new map.
     
    10561052    /// map interface for the digraph structure.
    10571053    /// This concept is part of the Digraph concept.
    1058     template <typename _Base = BaseDigraphComponent>
    1059     class MappableDigraphComponent : public _Base  {
    1060     public:
    1061 
    1062       typedef _Base Base;
     1054    template <typename BAS = BaseDigraphComponent>
     1055    class MappableDigraphComponent : public BAS  {
     1056    public:
     1057
     1058      typedef BAS Base;
    10631059      typedef typename Base::Node Node;
    10641060      typedef typename Base::Arc Arc;
     
    10701066      /// ReadWrite map of the nodes.
    10711067      ///
    1072       template <typename _Value>
    1073       class NodeMap : public GraphMap<Digraph, Node, _Value> {
     1068      template <typename V>
     1069      class NodeMap : public GraphMap<Digraph, Node, V> {
    10741070      public:
    1075         typedef GraphMap<MappableDigraphComponent, Node, _Value> Parent;
     1071        typedef GraphMap<MappableDigraphComponent, Node, V> Parent;
    10761072
    10771073        /// \brief Construct a new map.
     
    10841080        ///
    10851081        /// Construct a new map for the digraph and initalise the values.
    1086         NodeMap(const MappableDigraphComponent& digraph, const _Value& value)
     1082        NodeMap(const MappableDigraphComponent& digraph, const V& value)
    10871083          : Parent(digraph, value) {}
    10881084
     
    10981094        template <typename CMap>
    10991095        NodeMap& operator=(const CMap&) {
    1100           checkConcept<ReadMap<Node, _Value>, CMap>();
     1096          checkConcept<ReadMap<Node, V>, CMap>();
    11011097          return *this;
    11021098        }
     
    11081104      /// ReadWrite map of the arcs.
    11091105      ///
    1110       template <typename _Value>
    1111       class ArcMap : public GraphMap<Digraph, Arc, _Value> {
     1106      template <typename V>
     1107      class ArcMap : public GraphMap<Digraph, Arc, V> {
    11121108      public:
    1113         typedef GraphMap<MappableDigraphComponent, Arc, _Value> Parent;
     1109        typedef GraphMap<MappableDigraphComponent, Arc, V> Parent;
    11141110
    11151111        /// \brief Construct a new map.
     
    11221118        ///
    11231119        /// Construct a new map for the digraph and initalise the values.
    1124         ArcMap(const MappableDigraphComponent& digraph, const _Value& value)
     1120        ArcMap(const MappableDigraphComponent& digraph, const V& value)
    11251121          : Parent(digraph, value) {}
    11261122
     
    11361132        template <typename CMap>
    11371133        ArcMap& operator=(const CMap&) {
    1138           checkConcept<ReadMap<Arc, _Value>, CMap>();
     1134          checkConcept<ReadMap<Arc, V>, CMap>();
    11391135          return *this;
    11401136        }
     
    11921188    /// map interface for the graph structure.
    11931189    /// This concept is part of the Graph concept.
    1194     template <typename _Base = BaseGraphComponent>
    1195     class MappableGraphComponent : public MappableDigraphComponent<_Base>  {
    1196     public:
    1197 
    1198       typedef _Base Base;
     1190    template <typename BAS = BaseGraphComponent>
     1191    class MappableGraphComponent : public MappableDigraphComponent<BAS>  {
     1192    public:
     1193
     1194      typedef BAS Base;
    11991195      typedef typename Base::Edge Edge;
    12001196
     
    12051201      /// ReadWrite map of the edges.
    12061202      ///
    1207       template <typename _Value>
    1208       class EdgeMap : public GraphMap<Graph, Edge, _Value> {
     1203      template <typename V>
     1204      class EdgeMap : public GraphMap<Graph, Edge, V> {
    12091205      public:
    1210         typedef GraphMap<MappableGraphComponent, Edge, _Value> Parent;
     1206        typedef GraphMap<MappableGraphComponent, Edge, V> Parent;
    12111207
    12121208        /// \brief Construct a new map.
     
    12191215        ///
    12201216        /// Construct a new map for the graph and initalise the values.
    1221         EdgeMap(const MappableGraphComponent& graph, const _Value& value)
     1217        EdgeMap(const MappableGraphComponent& graph, const V& value)
    12221218          : Parent(graph, value) {}
    12231219
     
    12331229        template <typename CMap>
    12341230        EdgeMap& operator=(const CMap&) {
    1235           checkConcept<ReadMap<Edge, _Value>, CMap>();
     1231          checkConcept<ReadMap<Edge, V>, CMap>();
    12361232          return *this;
    12371233        }
     
    12771273    /// difference between the base and this interface is that the
    12781274    /// digraph alterations should handled already on this level.
    1279     template <typename _Base = BaseDigraphComponent>
    1280     class ExtendableDigraphComponent : public _Base {
    1281     public:
    1282       typedef _Base Base;
    1283 
    1284       typedef typename _Base::Node Node;
    1285       typedef typename _Base::Arc Arc;
     1275    template <typename BAS = BaseDigraphComponent>
     1276    class ExtendableDigraphComponent : public BAS {
     1277    public:
     1278      typedef BAS Base;
     1279
     1280      typedef typename Base::Node Node;
     1281      typedef typename Base::Arc Arc;
    12861282
    12871283      /// \brief Adds a new node to the digraph.
     
    13221318    /// that the graph alterations should handled already on this
    13231319    /// level.
    1324     template <typename _Base = BaseGraphComponent>
    1325     class ExtendableGraphComponent : public _Base {
    1326     public:
    1327 
    1328       typedef _Base Base;
    1329       typedef typename _Base::Node Node;
    1330       typedef typename _Base::Edge Edge;
     1320    template <typename BAS = BaseGraphComponent>
     1321    class ExtendableGraphComponent : public BAS {
     1322    public:
     1323
     1324      typedef BAS Base;
     1325      typedef typename Base::Node Node;
     1326      typedef typename Base::Edge Edge;
    13311327
    13321328      /// \brief Adds a new node to the graph.
     
    13661362    /// the base and this interface is that the digraph alterations
    13671363    /// should handled already on this level.
    1368     template <typename _Base = BaseDigraphComponent>
    1369     class ErasableDigraphComponent : public _Base {
    1370     public:
    1371 
    1372       typedef _Base Base;
     1364    template <typename BAS = BaseDigraphComponent>
     1365    class ErasableDigraphComponent : public BAS {
     1366    public:
     1367
     1368      typedef BAS Base;
    13731369      typedef typename Base::Node Node;
    13741370      typedef typename Base::Arc Arc;
     
    14061402    /// main difference between the base and this interface is that
    14071403    /// the graph alterations should handled already on this level.
    1408     template <typename _Base = BaseGraphComponent>
    1409     class ErasableGraphComponent : public _Base {
    1410     public:
    1411 
    1412       typedef _Base Base;
     1404    template <typename BAS = BaseGraphComponent>
     1405    class ErasableGraphComponent : public BAS {
     1406    public:
     1407
     1408      typedef BAS Base;
    14131409      typedef typename Base::Node Node;
    14141410      typedef typename Base::Edge Edge;
     
    14461442    /// the base and this interface is that the digraph alterations
    14471443    /// should handled already on this level.
    1448     template <typename _Base = BaseDigraphComponent>
    1449     class ClearableDigraphComponent : public _Base {
    1450     public:
    1451 
    1452       typedef _Base Base;
     1444    template <typename BAS = BaseDigraphComponent>
     1445    class ClearableDigraphComponent : public BAS {
     1446    public:
     1447
     1448      typedef BAS Base;
    14531449
    14541450      /// \brief Erase all nodes and arcs from the digraph.
     
    14751471    /// main difference between the base and this interface is that
    14761472    /// the graph alterations should handled already on this level.
    1477     template <typename _Base = BaseGraphComponent>
    1478     class ClearableGraphComponent : public ClearableDigraphComponent<_Base> {
    1479     public:
    1480 
    1481       typedef _Base Base;
     1473    template <typename BAS = BaseGraphComponent>
     1474    class ClearableGraphComponent : public ClearableDigraphComponent<BAS> {
     1475    public:
     1476
     1477      typedef BAS Base;
    14821478
    14831479      template <typename _Graph>
Note: See TracChangeset for help on using the changeset viewer.