COIN-OR::LEMON - Graph Library

Changeset 961:289d80c33f04 in lemon-0.x for src/lemon/concept/graph.h


Ignore:
Timestamp:
11/04/04 23:04:51 (19 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1344
Message:
  • Somewhat less redundant and a bit more correct graph concepts.
  • graph_wrapper_test does not compile
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/concept/graph.h

    r959 r961  
    766766
    767767
    768     /// \bug The nodes and edges are not allowed to inherit from the
    769     /// same baseclass.
    770 
    771     class BaseGraphItem {
    772     public:
    773       BaseGraphItem() {}
    774       BaseGraphItem(Invalid) {}
    775 
    776       // We explicitely list these:
    777       BaseGraphItem(BaseGraphItem const&) {}
    778       BaseGraphItem& operator=(BaseGraphItem const&) { return *this; }
    779 
    780       bool operator==(BaseGraphItem) const { return false; }
    781       bool operator!=(BaseGraphItem) const { return false; }
    782 
    783       // Technical requirement. Do we really need this?
    784       bool operator<(BaseGraphItem) const { return false; }
    785     };
    786 
    787 
    788768    /// A minimal GraphBase concept
    789769
     
    795775      GraphBase() {}
    796776
    797 
    798       /// \bug Nodes and Edges are comparable each other
    799      
    800       class Node : public BaseGraphItem {};
    801       class Edge : public BaseGraphItem {};
     777      /// \bug Should we demand that Node and Edge be subclasses of the
     778      /// Graph class???
     779
     780      typedef GraphItem<'n'> Node;
     781      typedef GraphItem<'e'> Edge;
     782
     783//       class Node : public BaseGraphItem<'n'> {};
     784//       class Edge : public BaseGraphItem<'e'> {};
    802785
    803786      // Graph operation
     
    841824
    842825
    843     /**************** Concept checking classes ****************/
    844 
    845     template<typename BGI>
    846     struct BaseGraphItemConcept {
    847       void constraints() {
    848         BGI i1;
    849         BGI i2 = i1;
    850         BGI i3 = INVALID;
    851        
    852         i1 = i3;
    853         if( i1 == i3 ) {
    854           if ( i2 != i3 && i3 < i2 )
    855             return;
    856         }
    857       }
    858     };
    859 
    860    
     826
     827    /**************** The full-featured graph concepts ****************/
     828
    861829   
    862830    class StaticGraph
    863       :  virtual public BaseGraphComponent, public IterableGraphComponent, public MappableGraphComponent {
     831      :  virtual public BaseGraphComponent,
     832         public IterableGraphComponent, public MappableGraphComponent {
    864833    public:
    865834      typedef BaseGraphComponent::Node Node;
     
    870839    struct StaticGraphConcept {
    871840      void constraints() {
    872         function_requires<BaseGraphComponentConcept<Graph> >();
    873841        function_requires<IterableGraphComponentConcept<Graph> >();
    874842        function_requires<MappableGraphComponentConcept<Graph> >();
    875843      }
    876       Graph& graph;
    877844    };
    878845
    879846    class ExtendableGraph
    880       :  virtual public BaseGraphComponent, public StaticGraph, public ExtendableGraphComponent, public ClearableGraphComponent {
     847      :  virtual public BaseGraphComponent, public StaticGraph,
     848         public ExtendableGraphComponent, public ClearableGraphComponent {
    881849    public:
    882850      typedef BaseGraphComponent::Node Node;
     
    891859        function_requires<ClearableGraphComponentConcept<Graph> >();
    892860      }
    893       Graph& graph;
    894861    };
    895862
    896863    class ErasableGraph
    897       :  virtual public BaseGraphComponent, public ExtendableGraph, public ErasableGraphComponent {
     864      :  virtual public BaseGraphComponent, public ExtendableGraph,
     865         public ErasableGraphComponent {
    898866    public:
    899867      typedef BaseGraphComponent::Node Node;
     
    907875        function_requires<ErasableGraphComponentConcept<Graph> >();
    908876      }
    909       Graph& graph;
    910877    };
    911878
Note: See TracChangeset for help on using the changeset viewer.