COIN-OR::LEMON - Graph Library

Changeset 2111:ea1fa1bc3f6d in lemon-0.x for lemon/concept/graph.h


Ignore:
Timestamp:
06/28/06 17:06:24 (14 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2817
Message:

Removing concepts for extendable and erasable graphs
Renaming StaticGraph? to Graph

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/concept/graph.h

    r2090 r2111  
    3939    // \brief Modular static graph class.
    4040    //     
    41     // It should be the same as the \c StaticGraph class.
    42     class _StaticGraph
     41    // It should be the same as the \c Graph class.
     42    class _Graph
    4343      :  virtual public BaseGraphComponent,
    4444         public IterableGraphComponent, public MappableGraphComponent {
     
    5757    };
    5858
    59     // \brief Modular extendable graph class.
    60     //     
    61     // It should be the same as the \c ExtendableGraph class.
    62     class _ExtendableGraph
    63       :  virtual public BaseGraphComponent, public _StaticGraph,
    64          public ExtendableGraphComponent, public ClearableGraphComponent {
    65     public:
    66       typedef BaseGraphComponent::Node Node;
    67       typedef BaseGraphComponent::Edge Edge;
    68 
    69       template <typename _Graph>
    70       struct Constraints {
    71         void constraints() {
    72           checkConcept<_StaticGraph, _Graph >();
    73           checkConcept<ExtendableGraphComponent, _Graph >();
    74           checkConcept<ClearableGraphComponent, _Graph >();
    75         }
    76       };
    77     };
    78 
    79     // \brief Modular erasable graph class.
    80     //     
    81     // It should be the same as the \c ErasableGraph class.
    82     class _ErasableGraph
    83       :  virtual public BaseGraphComponent, public _ExtendableGraph,
    84          public ErasableGraphComponent {
    85     public:
    86       typedef BaseGraphComponent::Node Node;
    87       typedef BaseGraphComponent::Edge Edge;
    88 
    89       template <typename _Graph>
    90       struct Constraints {
    91         void constraints() {
    92           checkConcept<_ExtendableGraph, _Graph >();
    93           checkConcept<ErasableGraphComponent, _Graph >();
    94         }
    95       };
    96     };
    97 
    9859    /// \addtogroup graph_concepts
    9960    /// @{
    10061
    101     /// An empty static graph class.
     62    /// An empty graph class.
    10263 
    10364    /// This class provides all the common features of a graph structure,
     
    11778    /// \todo A pages describing the concept of concept description would
    11879    /// be nice.
    119     class StaticGraph
    120     {
    121 //      ///Copy consructor.
    122 
    123 //       ///\todo It is not clear, what we expect from a copy constructor.
    124 //       ///E.g. How to assign the nodes/edges to each other? What about maps?
    125 //       StaticGraph(const StaticGraph& g) { }
     80    class Graph {
    12681    public:
    12782      ///\e
     
    13186      /// Defalult constructor.
    13287      ///
    133       StaticGraph() { }
     88      Graph() { }
    13489
    13590      /// The base type of node iterators,
     
    214169        /// Sets the iterator to the first node of \c g.
    215170        ///
    216         NodeIt(const StaticGraph&) { }
     171        NodeIt(const Graph&) { }
    217172        /// Node -> NodeIt conversion.
    218173
     
    221176        /// This feature necessitates that each time we
    222177        /// iterate the edge-set, the iteration order is the same.
    223         NodeIt(const StaticGraph&, const Node&) { }
     178        NodeIt(const Graph&, const Node&) { }
    224179        /// Next node.
    225180
     
    308263        /// This constructor sets the iterator to the first outgoing edge of
    309264        /// the node.
    310         OutEdgeIt(const StaticGraph&, const Node&) { }
     265        OutEdgeIt(const Graph&, const Node&) { }
    311266        /// Edge -> OutEdgeIt conversion
    312267
     
    314269        /// This feature necessitates that each time we
    315270        /// iterate the edge-set, the iteration order is the same.
    316         OutEdgeIt(const StaticGraph&, const Edge&) { }
     271        OutEdgeIt(const Graph&, const Edge&) { }
    317272        ///Next outgoing edge
    318273       
     
    355310        /// This constructor set the iterator to the first incoming edge of
    356311        /// the node.
    357         InEdgeIt(const StaticGraph&, const Node&) { }
     312        InEdgeIt(const Graph&, const Node&) { }
    358313        /// Edge -> InEdgeIt conversion
    359314
     
    361316        /// This feature necessitates that each time we
    362317        /// iterate the edge-set, the iteration order is the same.
    363         InEdgeIt(const StaticGraph&, const Edge&) { }
     318        InEdgeIt(const Graph&, const Edge&) { }
    364319        /// Next incoming edge
    365320
     
    398353        /// This constructor sets the iterator to the first edge of \c g.
    399354        ///@param g the graph
    400         EdgeIt(const StaticGraph& g) { ignore_unused_variable_warning(g); }
     355        EdgeIt(const Graph& g) { ignore_unused_variable_warning(g); }
    401356        /// Edge -> EdgeIt conversion
    402357
     
    404359        /// This feature necessitates that each time we
    405360        /// iterate the edge-set, the iteration order is the same.
    406         EdgeIt(const StaticGraph&, const Edge&) { }
     361        EdgeIt(const Graph&, const Edge&) { }
    407362        ///Next edge
    408363       
     
    421376      Node source(Edge) const { return INVALID; }
    422377
    423 //       /// Gives back the first Node in the iterating order.
    424      
    425 //       /// Gives back the first Node in the iterating order.
    426 //       ///     
    427378      void first(Node&) const {}
    428 
    429 //       /// Gives back the next Node in the iterating order.
    430      
    431 //       /// Gives back the next Node in the iterating order.
    432 //       ///     
    433379      void next(Node&) const {}
    434380
    435 //       /// Gives back the first Edge in the iterating order.
    436      
    437 //       /// Gives back the first Edge in the iterating order.
    438 //       ///     
    439381      void first(Edge&) const {}
    440 //       /// Gives back the next Edge in the iterating order.
    441      
    442 //       /// Gives back the next Edge in the iterating order.
    443 //       ///     
    444382      void next(Edge&) const {}
    445383
    446384
    447 //       /// Gives back the first of the Edges point to the given Node.
    448      
    449 //       /// Gives back the first of the Edges point to the given Node.
    450 //       ///     
    451385      void firstIn(Edge&, const Node&) const {}
    452 
    453 //       /// Gives back the next of the Edges points to the given Node.
    454 
    455 
    456 //       /// Gives back the next of the Edges points to the given Node.
    457 //       ///
    458386      void nextIn(Edge&) const {}
    459387
    460 //       /// Gives back the first of the Edges start from the given Node.
    461      
    462 //       /// Gives back the first of the Edges start from the given Node.
    463 //       ///     
    464388      void firstOut(Edge&, const Node&) const {}
    465 
    466 //       /// Gives back the next of the Edges start from the given Node.
    467      
    468 //       /// Gives back the next of the Edges start from the given Node.
    469 //       ///     
    470389      void nextOut(Edge&) const {}
    471390
     
    512431
    513432        ///\e
    514         NodeMap(const StaticGraph&) { }
     433        NodeMap(const Graph&) { }
    515434        ///\e
    516         NodeMap(const StaticGraph&, T) { }
     435        NodeMap(const Graph&, T) { }
    517436
    518437        ///Copy constructor
     
    536455
    537456        ///\e
    538         EdgeMap(const StaticGraph&) { }
     457        EdgeMap(const Graph&) { }
    539458        ///\e
    540         EdgeMap(const StaticGraph&, T) { }
     459        EdgeMap(const Graph&, T) { }
    541460        ///Copy constructor
    542461        EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
     
    546465      };
    547466
    548       template <typename _Graph>
    549       struct Constraints : public _StaticGraph::Constraints<_Graph> {};
    550 
    551     };
    552 
    553     /// An empty non-static graph class.
    554    
    555     /// This class provides everything that \ref StaticGraph does.
    556     /// Additionally it enables building graphs from scratch.
    557     class ExtendableGraph : public StaticGraph
    558     {
    559     public:
    560       /// Defalult constructor.
    561 
    562       /// Defalult constructor.
    563       ///
    564       ExtendableGraph() { }
    565       ///Add a new node to the graph.
    566 
    567       /// \return the new node.
    568       ///
    569       Node addNode() { return INVALID; }
    570       ///Add a new edge to the graph.
    571 
    572       ///Add a new edge to the graph with source node \c s
    573       ///and target node \c t.
    574       ///\return the new edge.
    575       Edge addEdge(Node, Node) { return INVALID; }
    576    
    577       /// Resets the graph.
    578 
    579       /// This function deletes all edges and nodes of the graph.
    580       /// It also frees the memory allocated to store them.
    581       /// \todo It might belong to \ref ErasableGraph.
    582       void clear() { }
    583 
    584       template <typename _Graph>
    585       struct Constraints : public _ExtendableGraph::Constraints<_Graph> {};
    586 
    587     };
    588 
    589     /// An empty erasable graph class.
    590  
    591     /// This class is an extension of \ref ExtendableGraph. It makes it
    592     /// possible to erase edges or nodes.
    593     class ErasableGraph : public ExtendableGraph
    594     {
    595     public:
    596       /// Defalult constructor.
    597 
    598       /// Defalult constructor.
    599       ///
    600       ErasableGraph() { }
    601       /// Deletes a node.
    602 
    603       /// Deletes node \c n node.
    604       ///
    605       void erase(Node) { }
    606       /// Deletes an edge.
    607 
    608       /// Deletes edge \c e edge.
    609       ///
    610       void erase(Edge) { }
    611 
    612       template <typename _Graph>
    613       struct Constraints : public _ErasableGraph::Constraints<_Graph> {};
     467      template <typename RGraph>
     468      struct Constraints : public _Graph::Constraints<RGraph> {};
    614469
    615470    };
Note: See TracChangeset for help on using the changeset viewer.