lemon/smart_graph.h
changeset 1909 2d806130e700
parent 1875 98698b69a902
child 1910 f95eea8c34b0
equal deleted inserted replaced
13:cf90d90c3571 14:44ab5d7baf9c
    17 #ifndef LEMON_SMART_GRAPH_H
    17 #ifndef LEMON_SMART_GRAPH_H
    18 #define LEMON_SMART_GRAPH_H
    18 #define LEMON_SMART_GRAPH_H
    19 
    19 
    20 ///\ingroup graphs
    20 ///\ingroup graphs
    21 ///\file
    21 ///\file
    22 ///\brief SmartGraph and UndirSmartGraph classes.
    22 ///\brief SmartGraph and SmartUGraph classes.
    23 
    23 
    24 #include <vector>
    24 #include <vector>
    25 
    25 
    26 #include <lemon/invalid.h>
    26 #include <lemon/invalid.h>
    27 
    27 
   351   };
   351   };
   352 
   352 
   353 
   353 
   354   /**************** Undirected List Graph ****************/
   354   /**************** Undirected List Graph ****************/
   355 
   355 
   356   typedef ClearableUndirGraphExtender<
   356   typedef ClearableUGraphExtender<
   357     ExtendableUndirGraphExtender<
   357     ExtendableUGraphExtender<
   358     MappableUndirGraphExtender<
   358     MappableUGraphExtender<
   359     IterableUndirGraphExtender<
   359     IterableUGraphExtender<
   360     AlterableUndirGraphExtender<
   360     AlterableUGraphExtender<
   361     UndirGraphExtender<SmartGraphBase> > > > > > ExtendedUndirSmartGraphBase;
   361     UGraphExtender<SmartGraphBase> > > > > > ExtendedSmartUGraphBase;
   362 
   362 
   363   ///A smart undirected graph class.
   363   /// \ingroup graphs
   364 
       
   365   ///This is a simple and fast undirected graph implementation.
       
   366   ///It is also quite memory efficient, but at the price
       
   367   ///that <b> it does support only limited (only stack-like)
       
   368   ///node and edge deletions</b>.
       
   369   ///Except from this it conforms to 
       
   370   ///the \ref concept::UndirGraph "UndirGraph" concept.
       
   371   ///\sa concept::UndirGraph.
       
   372   ///
   364   ///
   373   ///\todo Snapshot hasn't been implemented yet.
   365   /// \brief A smart undirected graph class.
   374   ///
   366   ///
   375   class UndirSmartGraph : public ExtendedUndirSmartGraphBase {
   367   /// This is a simple and fast undirected graph implementation.
       
   368   /// It is also quite memory efficient, but at the price
       
   369   /// that <b> it does support only limited (only stack-like)
       
   370   /// node and edge deletions</b>.
       
   371   /// Except from this it conforms to 
       
   372   /// the \ref concept::UGraph "UGraph" concept.
       
   373   /// \sa concept::UGraph.
       
   374   ///
       
   375   /// \todo Snapshot hasn't been implemented yet.
       
   376   ///
       
   377   class SmartUGraph : public ExtendedSmartUGraphBase {
   376   };
   378   };
   377 
   379 
   378 
   380 
   379   class SmartUndirBipartiteGraphBase {
   381   class SmartUBipartiteGraphBase {
   380   public:
   382   public:
   381 
   383 
   382     class NodeSetError : public LogicError {
   384     class NodeSetError : public LogicError {
   383       virtual const char* exceptionName() const { 
   385       virtual const char* exceptionName() const { 
   384 	return "lemon::FullUndirBipartiteGraph::NodeSetError";
   386 	return "lemon::FullUBipartiteGraph::NodeSetError";
   385       }
   387       }
   386     };
   388     };
   387 
   389 
   388   protected:
   390   protected:
   389 
   391 
   404     std::vector<EdgeT> edges;
   406     std::vector<EdgeT> edges;
   405 
   407 
   406   public:
   408   public:
   407   
   409   
   408     class Node {
   410     class Node {
   409       friend class SmartUndirBipartiteGraphBase;
   411       friend class SmartUBipartiteGraphBase;
   410     protected:
   412     protected:
   411       int id;
   413       int id;
   412 
   414 
   413       Node(int _id) : id(_id) {}
   415       Node(int _id) : id(_id) {}
   414     public:
   416     public:
   418       bool operator!=(const Node i) const {return id!=i.id;}
   420       bool operator!=(const Node i) const {return id!=i.id;}
   419       bool operator<(const Node i) const {return id<i.id;}
   421       bool operator<(const Node i) const {return id<i.id;}
   420     };
   422     };
   421 
   423 
   422     class Edge {
   424     class Edge {
   423       friend class SmartUndirBipartiteGraphBase;
   425       friend class SmartUBipartiteGraphBase;
   424     protected:
   426     protected:
   425       int id;
   427       int id;
   426 
   428 
   427       Edge(int _id) { id = _id;}
   429       Edge(int _id) { id = _id;}
   428     public:
   430     public:
   581     }
   583     }
   582 
   584 
   583   };
   585   };
   584 
   586 
   585 
   587 
   586   typedef ClearableUndirBipartiteGraphExtender<
   588   typedef ClearableUBipartiteGraphExtender<
   587     ExtendableUndirBipartiteGraphExtender<
   589     ExtendableUBipartiteGraphExtender<
   588     MappableUndirBipartiteGraphExtender<
   590     MappableUBipartiteGraphExtender<
   589     IterableUndirBipartiteGraphExtender<
   591     IterableUBipartiteGraphExtender<
   590     AlterableUndirBipartiteGraphExtender<
   592     AlterableUBipartiteGraphExtender<
   591     UndirBipartiteGraphExtender <
   593     UBipartiteGraphExtender <
   592     SmartUndirBipartiteGraphBase> > > > > >
   594     SmartUBipartiteGraphBase> > > > > >
   593   ExtendedSmartUndirBipartiteGraphBase;
   595   ExtendedSmartUBipartiteGraphBase;
   594 
   596 
   595 
   597 
   596   class SmartUndirBipartiteGraph : 
   598   class SmartUBipartiteGraph : 
   597     public ExtendedSmartUndirBipartiteGraphBase {
   599     public ExtendedSmartUBipartiteGraphBase {
   598   };
   600   };
   599 
   601 
   600   
   602   
   601   /// @}  
   603   /// @}  
   602 } //namespace lemon
   604 } //namespace lemon