lemon/bits/graph_extender.h
changeset 625 029a48052c67
parent 440 88ed40ad0d4f
child 685 a27356ceb5bd
equal deleted inserted replaced
10:a2cf65d322af 11:c955bce9544d
    35   // \ingroup graphbits
    35   // \ingroup graphbits
    36   //
    36   //
    37   // \brief Extender for the digraph implementations
    37   // \brief Extender for the digraph implementations
    38   template <typename Base>
    38   template <typename Base>
    39   class DigraphExtender : public Base {
    39   class DigraphExtender : public Base {
       
    40     typedef Base Parent;
       
    41 
    40   public:
    42   public:
    41 
    43 
    42     typedef Base Parent;
       
    43     typedef DigraphExtender Digraph;
    44     typedef DigraphExtender Digraph;
    44 
    45 
    45     // Base extensions
    46     // Base extensions
    46 
    47 
    47     typedef typename Parent::Node Node;
    48     typedef typename Parent::Node Node;
   216 
   217 
   217 
   218 
   218     template <typename _Value>
   219     template <typename _Value>
   219     class NodeMap
   220     class NodeMap
   220       : public MapExtender<DefaultMap<Digraph, Node, _Value> > {
   221       : public MapExtender<DefaultMap<Digraph, Node, _Value> > {
   221     public:
       
   222       typedef DigraphExtender Digraph;
       
   223       typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent;
   222       typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent;
   224 
   223 
       
   224     public:
   225       explicit NodeMap(const Digraph& digraph)
   225       explicit NodeMap(const Digraph& digraph)
   226         : Parent(digraph) {}
   226         : Parent(digraph) {}
   227       NodeMap(const Digraph& digraph, const _Value& value)
   227       NodeMap(const Digraph& digraph, const _Value& value)
   228         : Parent(digraph, value) {}
   228         : Parent(digraph, value) {}
   229 
   229 
   241     };
   241     };
   242 
   242 
   243     template <typename _Value>
   243     template <typename _Value>
   244     class ArcMap
   244     class ArcMap
   245       : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
   245       : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
   246     public:
       
   247       typedef DigraphExtender Digraph;
       
   248       typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
   246       typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
   249 
   247 
       
   248     public:
   250       explicit ArcMap(const Digraph& digraph)
   249       explicit ArcMap(const Digraph& digraph)
   251         : Parent(digraph) {}
   250         : Parent(digraph) {}
   252       ArcMap(const Digraph& digraph, const _Value& value)
   251       ArcMap(const Digraph& digraph, const _Value& value)
   253         : Parent(digraph, value) {}
   252         : Parent(digraph, value) {}
   254 
   253 
   328   // \ingroup _graphbits
   327   // \ingroup _graphbits
   329   //
   328   //
   330   // \brief Extender for the Graphs
   329   // \brief Extender for the Graphs
   331   template <typename Base>
   330   template <typename Base>
   332   class GraphExtender : public Base {
   331   class GraphExtender : public Base {
       
   332     typedef Base Parent;
       
   333 
   333   public:
   334   public:
   334 
   335 
   335     typedef Base Parent;
       
   336     typedef GraphExtender Graph;
   336     typedef GraphExtender Graph;
   337 
   337 
   338     typedef True UndirectedTag;
   338     typedef True UndirectedTag;
   339 
   339 
   340     typedef typename Parent::Node Node;
   340     typedef typename Parent::Node Node;
   599     // Mappable extension
   599     // Mappable extension
   600 
   600 
   601     template <typename _Value>
   601     template <typename _Value>
   602     class NodeMap
   602     class NodeMap
   603       : public MapExtender<DefaultMap<Graph, Node, _Value> > {
   603       : public MapExtender<DefaultMap<Graph, Node, _Value> > {
   604     public:
       
   605       typedef GraphExtender Graph;
       
   606       typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent;
   604       typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent;
   607 
   605 
       
   606     public:
   608       NodeMap(const Graph& graph)
   607       NodeMap(const Graph& graph)
   609         : Parent(graph) {}
   608         : Parent(graph) {}
   610       NodeMap(const Graph& graph, const _Value& value)
   609       NodeMap(const Graph& graph, const _Value& value)
   611         : Parent(graph, value) {}
   610         : Parent(graph, value) {}
   612 
   611 
   624     };
   623     };
   625 
   624 
   626     template <typename _Value>
   625     template <typename _Value>
   627     class ArcMap
   626     class ArcMap
   628       : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
   627       : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
   629     public:
       
   630       typedef GraphExtender Graph;
       
   631       typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
   628       typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
   632 
   629 
       
   630     public:
   633       ArcMap(const Graph& graph)
   631       ArcMap(const Graph& graph)
   634         : Parent(graph) {}
   632         : Parent(graph) {}
   635       ArcMap(const Graph& graph, const _Value& value)
   633       ArcMap(const Graph& graph, const _Value& value)
   636         : Parent(graph, value) {}
   634         : Parent(graph, value) {}
   637 
   635 
   649 
   647 
   650 
   648 
   651     template <typename _Value>
   649     template <typename _Value>
   652     class EdgeMap
   650     class EdgeMap
   653       : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
   651       : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
   654     public:
       
   655       typedef GraphExtender Graph;
       
   656       typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
   652       typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
   657 
   653 
       
   654     public:
   658       EdgeMap(const Graph& graph)
   655       EdgeMap(const Graph& graph)
   659         : Parent(graph) {}
   656         : Parent(graph) {}
   660 
   657 
   661       EdgeMap(const Graph& graph, const _Value& value)
   658       EdgeMap(const Graph& graph, const _Value& value)
   662         : Parent(graph, value) {}
   659         : Parent(graph, value) {}