COIN-OR::LEMON - Graph Library

Changeset 1791:62e7d237e1fb in lemon-0.x


Ignore:
Timestamp:
11/14/05 19:38:41 (18 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2332
Message:

Modification on the base graph concept
The extended interface does not changed

Location:
lemon
Files:
1 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • lemon/full_graph.h

    r1726 r1791  
    2424#include <lemon/bits/alteration_notifier.h>
    2525#include <lemon/bits/static_map.h>
    26 
    27 #include <lemon/bits/undir_graph_extender.h>
     26#include <lemon/bits/graph_extender.h>
    2827
    2928#include <lemon/invalid.h>
     
    7170    /// Maximum node ID.
    7271    ///\sa id(Node)
    73     int maxId(Node = INVALID) const { return _nodeNum-1; }
     72    int maxNodeId() const { return _nodeNum-1; }
    7473    /// Maximum edge ID.
    7574   
    7675    /// Maximum edge ID.
    7776    ///\sa id(Edge)
    78     int maxId(Edge = INVALID) const { return _edgeNum-1; }
     77    int maxEdgeId() const { return _edgeNum-1; }
    7978
    8079    Node source(Edge e) const { return e.id % _nodeNum; }
     
    102101    static int id(Edge e) { return e.id; }
    103102
    104     static Node fromId(int id, Node) { return Node(id);}
    105    
    106     static Edge fromId(int id, Edge) { return Edge(id);}
     103    static Node nodeFromId(int id) { return Node(id);}
     104   
     105    static Edge edgeFromId(int id) { return Edge(id);}
    107106
    108107    typedef True FindEdgeTag;
     
    191190  };
    192191
    193 
    194   typedef AlterableGraphExtender<FullGraphBase>
    195   AlterableFullGraphBase;
    196   typedef IterableGraphExtender<AlterableFullGraphBase>
    197   IterableFullGraphBase;
    198192  typedef StaticMappableGraphExtender<
    199193    IterableGraphExtender<
    200     AlterableGraphExtender<FullGraphBase> > > ExtendedFullGraphBase;
     194    AlterableGraphExtender<
     195    GraphExtender<FullGraphBase> > > > ExtendedFullGraphBase;
    201196
    202197  /// \ingroup graphs
     
    218213  };
    219214
    220   ///@}
    221215
    222216  class UndirFullGraphBase {
     
    253247    /// Maximum node ID.
    254248    ///\sa id(Node)
    255     int maxId(Node = INVALID) const { return _nodeNum-1; }
     249    int maxNodeId() const { return _nodeNum-1; }
    256250    /// Maximum edge ID.
    257251   
    258252    /// Maximum edge ID.
    259253    ///\sa id(Edge)
    260     int maxId(Edge = INVALID) const { return _edgeNum-1; }
     254    int maxEdgeId() const { return _edgeNum-1; }
    261255
    262256    Node source(Edge e) const {
  • lemon/graph_adaptor.h

    r1755 r1791  
    3434#include <lemon/bits/alteration_notifier.h>
    3535#include <lemon/bits/default_map.h>
    36 #include <lemon/bits/undir_graph_extender.h>
     36#include <lemon/bits/graph_extender.h>
    3737#include <iostream>
    3838
     
    18601860    int id(const Edge& edge) const { return edge.id; }
    18611861
    1862     Node fromId(int id, Node) const { return graph->fromId(id, Node()); }
    1863     Edge fromId(int id, Edge) const { return Edge(id); }
    1864 
    1865     int maxId(Node) const { return graph->maxId(Node()); };
    1866     int maxId(Edge) const { return edges.size() - 1; }
     1862    Node nodeFromId(int id) const { return graph->fromId(id, Node()); }
     1863    Edge edgeFromId(int id) const { return Edge(id); }
     1864
     1865    int maxNodeId() const { return graph->maxId(Node()); };
     1866    int maxEdgeId() const { return edges.size() - 1; }
    18671867
    18681868    Node source(const Edge& edge) const { return edges[edge.id].source;}
  • lemon/grid_graph.h

    r1703 r1791  
    2525#include <lemon/bits/alteration_notifier.h>
    2626#include <lemon/bits/static_map.h>
    27 
    28 #include <lemon/bits/undir_graph_extender.h>
     27#include <lemon/bits/graph_extender.h>
    2928
    3029#include <lemon/xy.h>
     
    165164    /// Maximum node ID.
    166165    ///\sa id(Node)
    167     int maxId(Node = INVALID) const { return nodeNum() - 1; }
     166    int maxNodeId() const { return nodeNum() - 1; }
    168167    /// Maximum edge ID.
    169168   
    170169    /// Maximum edge ID.
    171170    ///\sa id(Edge)
    172     int maxId(Edge = INVALID) const { return edgeNum() - 1; }
     171    int maxEdgeId() const { return edgeNum() - 1; }
    173172
    174173    /// \brief Gives back the source node of an edge.
     
    216215    static int id(Edge e) { return e.id; }
    217216
    218     static Node fromId(int id, Node) { return Node(id);}
    219    
    220     static Edge fromId(int id, Edge) { return Edge(id);}
     217    static Node nodeFromId(int id) { return Node(id);}
     218   
     219    static Edge edgeFromId(int id) { return Edge(id);}
    221220
    222221    typedef True FindEdgeTag;
     
    359358  /// GridGraph graph(h, w);
    360359  /// GridGraph::NodeMap<int> val(graph);
    361   /// for (int i = 0; i < graph.height(); ++i) {
    362   ///   for (int j = 0; j < graph.width(); ++j) {
     360  /// for (int i = 0; i < graph.width(); ++i) {
     361  ///   for (int j = 0; j < graph.height(); ++j) {
    363362  ///     val[graph(i, j)] = i + j;
    364363  ///   }
     
    504503  /// \brief Row map of the grid graph
    505504  ///
    506   /// Just returns an RowMap for the grid graph.
     505  /// Just returns a RowMap for the grid graph.
    507506  GridGraph::RowMap rowMap(const GridGraph& graph) {
    508507    return GridGraph::RowMap(graph);
    509508  }
    510509
    511   /// \brief Coloumn map of the grid graph
    512   ///
    513   /// Just returns an ColMap for the grid graph.
     510  /// \brief Column map of the grid graph
     511  ///
     512  /// Just returns a ColMap for the grid graph.
    514513  GridGraph::ColMap colMap(const GridGraph& graph) {
    515514    return GridGraph::ColMap(graph);
  • lemon/hypercube_graph.h

    r1703 r1791  
    2222#include <lemon/invalid.h>
    2323#include <lemon/utility.h>
     24#include <lemon/error.h>
    2425
    2526#include <lemon/bits/iterable_graph_extender.h>
    2627#include <lemon/bits/alteration_notifier.h>
    2728#include <lemon/bits/default_map.h>
     29#include <lemon/bits/graph_extender.h>
    2830
    2931///\ingroup graphs
     
    3335namespace lemon {
    3436
    35   /// \brief Base graph for HyperGraph.
     37  /// \brief Base graph for HyperCubeGraph.
    3638  ///
    3739  /// Base graph for hyper-cube graph. It describes some member functions
     
    7880    /// Maximum node ID.
    7981    ///\sa id(Node)
    80     int maxId(Node = INVALID) const { return nodeNum() - 1; }
     82    int maxNodeId() const { return nodeNum() - 1; }
    8183    /// Maximum edge ID.
    8284   
    8385    /// Maximum edge ID.
    8486    ///\sa id(Edge)
    85     int maxId(Edge = INVALID) const { return edgeNum() - 1; }
     87    int maxEdgeId() const { return edgeNum() - 1; }
    8688
    8789    /// \brief Gives back the source node of an edge.
     
    119121    static int id(Edge e) { return e.id; }
    120122
    121     static Node fromId(int id, Node) { return Node(id);}
    122    
    123     static Edge fromId(int id, Edge) { return Edge(id);}
     123    static Node nodeFromId(int id) { return Node(id);}
     124   
     125    static Edge edgeFromId(int id) { return Edge(id);}
    124126
    125127    class Node {
     
    236238    IterableGraphExtender<
    237239    AlterableGraphExtender<
    238     HyperCubeGraphBase > > > ExtendedHyperCubeGraphBase;
     240    GraphExtender<
     241    HyperCubeGraphBase> > > > ExtendedHyperCubeGraphBase;
    239242
    240243  /// \ingroup graphs
     
    308311                   T fv = 0.0, const BF& bf = BF())
    309312        : _graph(graph), _values(begin, end), _first_value(fv), _bin_func(bf) {
    310         if (_values.size() != graph.dimension()) {}
     313        LEMON_ASSERT(_values.size() != graph.dimension(),
     314                     "Wrong size of dimension");
    311315      }
    312316
  • lemon/list_graph.h

    r1774 r1791  
    2828#include <lemon/bits/alteration_notifier.h>
    2929#include <lemon/bits/default_map.h>
    30 
    31 #include <lemon/bits/undir_graph_extender.h>
     30#include <lemon/bits/graph_extender.h>
    3231
    3332#include <lemon/error.h>
     
    106105    /// Maximum node ID.
    107106    ///\sa id(Node)
    108     int maxId(Node = INVALID) const { return nodes.size()-1; }
     107    int maxNodeId() const { return nodes.size()-1; }
    109108
    110109    /// Maximum edge ID.
     
    112111    /// Maximum edge ID.
    113112    ///\sa id(Edge)
    114     int maxId(Edge = INVALID) const { return edges.size()-1; }
     113    int maxEdgeId() const { return edges.size()-1; }
    115114
    116115    Node source(Edge e) const { return edges[e.id].source; }
     
    165164    static int id(Edge e) { return e.id; }
    166165
    167     static Node fromId(int id, Node) { return Node(id);}
    168     static Edge fromId(int id, Edge) { return Edge(id);}
     166    static Node nodeFromId(int id) { return Node(id);}
     167    static Edge edgeFromId(int id) { return Edge(id);}
    169168
    170169    /// Adds a new node to the graph.
     
    316315    MappableGraphExtender<
    317316    IterableGraphExtender<
    318     AlterableGraphExtender<ListGraphBase> > > > > > ExtendedListGraphBase;
     317    AlterableGraphExtender<
     318    GraphExtender<ListGraphBase> > > > > > > ExtendedListGraphBase;
    319319
    320320  /// \addtogroup graphs
  • lemon/smart_graph.h

    r1770 r1791  
    3131#include <lemon/bits/alteration_notifier.h>
    3232#include <lemon/bits/default_map.h>
    33 
    34 #include <lemon/bits/undir_graph_extender.h>
     33#include <lemon/bits/graph_extender.h>
    3534
    3635#include <lemon/utility.h>
     
    9190    /// Maximum node ID.
    9291    ///\sa id(Node)
    93     int maxId(Node) const { return nodes.size()-1; }
     92    int maxNodeId() const { return nodes.size()-1; }
    9493    /// Maximum edge ID.
    9594   
    9695    /// Maximum edge ID.
    9796    ///\sa id(Edge)
    98     int maxId(Edge) const { return edges.size()-1; }
     97    int maxEdgeId() const { return edges.size()-1; }
    9998
    10099    Node source(Edge e) const { return edges[e.n].source; }
     
    104103   
    105104    /// The ID of a valid Node is a nonnegative integer not greater than
    106     /// \ref maxId(Node). The range of the ID's is not surely continuous
    107     /// and the greatest node ID can be actually less then \ref maxId(Node).
     105    /// \ref maxNodeId(). The range of the ID's is not surely continuous
     106    /// and the greatest node ID can be actually less then \ref maxNodeId().
    108107    ///
    109108    /// The ID of the \ref INVALID node is -1.
     
    113112   
    114113    /// The ID of a valid Edge is a nonnegative integer not greater than
    115     /// \ref maxId(Edge). The range of the ID's is not surely continuous
    116     /// and the greatest edge ID can be actually less then \ref maxId(Edge).
     114    /// \ref maxEdgeId(). The range of the ID's is not surely continuous
     115    /// and the greatest edge ID can be actually less then \ref maxEdgeId().
    117116    ///
    118117    /// The ID of the \ref INVALID edge is -1.
     
    120119    static int id(Edge e) { return e.n; }
    121120
    122     static Node fromId(int id, Node) { return Node(id);}
    123 
    124     static Edge fromId(int id, Edge) { return Edge(id);}
     121    static Node nodeFromId(int id) { return Node(id);}
     122
     123    static Edge edgeFromId(int id) { return Edge(id);}
    125124
    126125    Node addNode() {
     
    152151    protected:
    153152      int n;
    154       ///\e
    155 
    156       ///\todo It should be removed (or at least define a setToId() instead).
    157       ///
    158153      Node(int nn) {n=nn;}
    159154    public:
     
    172167    protected:
    173168      int n;
    174       ///\todo It should be removed (or at least define a setToId() instead).
    175       ///
    176169      Edge(int nn) {n=nn;}
    177170    public:
     
    231224    MappableGraphExtender<
    232225    IterableGraphExtender<
    233     AlterableGraphExtender<SmartGraphBase> > > > > ExtendedSmartGraphBase;
    234 
    235   /// \addtogroup graphs
    236   /// @{
     226    AlterableGraphExtender<
     227    GraphExtender<SmartGraphBase> > > > > > ExtendedSmartGraphBase;
     228
     229  /// \ingroup graphs
    237230
    238231  ///A smart graph class.
Note: See TracChangeset for help on using the changeset viewer.