lemon/sub_graph.h
changeset 1991 d7442141d9ef
parent 1979 c2992fd74dad
child 2006 00d59f733817
equal deleted inserted replaced
5:c7d04a686216 6:2fbe8b156bf7
    18 
    18 
    19 #ifndef LEMON_SUB_GRAPH_H
    19 #ifndef LEMON_SUB_GRAPH_H
    20 #define LEMON_SUB_GRAPH_H
    20 #define LEMON_SUB_GRAPH_H
    21 
    21 
    22 #include <lemon/graph_adaptor.h>
    22 #include <lemon/graph_adaptor.h>
       
    23 #include <lemon/bits/graph_adaptor_extender.h>
       
    24 #include <lemon/bits/default_map.h>
    23 
    25 
    24 namespace lemon {
    26 namespace lemon {
    25 
    27 
    26   /// \brief Base for the SubGraph.
    28   /// \brief Base for the SubGraph.
    27   ///
    29   ///
   240   protected:
   242   protected:
   241     struct NodeT {
   243     struct NodeT {
   242       Node prev, next;
   244       Node prev, next;
   243       Edge firstIn, firstOut;
   245       Edge firstIn, firstOut;
   244     };
   246     };
   245     class NodesImpl : public Graph::template NodeMap<NodeT> {
   247     class NodesImpl : public DefaultMap<Graph, Node, NodeT> {
   246       friend class SubGraphBase;
   248       friend class SubGraphBase;
   247     public:
   249     public:
   248       typedef typename Graph::template NodeMap<NodeT> Parent;
   250       typedef DefaultMap<Graph, Node, NodeT> Parent;
   249 
   251 
   250       NodesImpl(SubGraph& _adaptor, const Graph& _graph) 
   252       NodesImpl(SubGraph& _adaptor, const Graph& _graph) 
   251 	: Parent(_graph), adaptor(_adaptor) {}
   253 	: Parent(_graph), adaptor(_adaptor) {}
   252 
   254 
   253       virtual ~NodesImpl() {}
   255       virtual ~NodesImpl() {}
   303 
   305 
   304     struct EdgeT {
   306     struct EdgeT {
   305       Edge prevOut, nextOut;
   307       Edge prevOut, nextOut;
   306       Edge prevIn, nextIn;
   308       Edge prevIn, nextIn;
   307     };
   309     };
   308     class EdgesImpl : public Graph::template EdgeMap<EdgeT> {
   310     class EdgesImpl : public DefaultMap<Graph, Edge, EdgeT> {
   309       friend class SubGraphBase;
   311       friend class SubGraphBase;
   310     public:
   312     public:
   311       typedef typename Graph::template EdgeMap<EdgeT> Parent;
   313       typedef DefaultMap<Graph, Edge, EdgeT> Parent;
   312 
   314 
   313       EdgesImpl(SubGraph& _adaptor, const Graph& _graph) 
   315       EdgesImpl(SubGraph& _adaptor, const Graph& _graph) 
   314 	: Parent(_graph), adaptor(_adaptor) {}
   316 	: Parent(_graph), adaptor(_adaptor) {}
   315 
   317 
   316       virtual ~EdgesImpl() {}
   318       virtual ~EdgesImpl() {}
   558     
   560     
   559   protected:
   561   protected:
   560     struct NodeT {
   562     struct NodeT {
   561       Edge firstIn, firstOut;
   563       Edge firstIn, firstOut;
   562     };
   564     };
   563     class NodesImpl : public Graph::template NodeMap<NodeT> {
   565     class NodesImpl : public DefaultMap<Graph, Node, NodeT> {
   564       friend class EdgeSubGraphBase;
   566       friend class EdgeSubGraphBase;
   565     public:
   567     public:
   566       typedef typename Graph::template NodeMap<NodeT> Parent;
   568       typedef DefaultMap<Graph, Node, NodeT> Parent;
   567 
   569 
   568       NodesImpl(SubGraph& _adaptor, const Graph& _graph) 
   570       NodesImpl(SubGraph& _adaptor, const Graph& _graph) 
   569 	: Parent(_graph), adaptor(_adaptor) {}
   571 	: Parent(_graph), adaptor(_adaptor) {}
   570 
   572 
   571       virtual ~NodesImpl() {}
   573       virtual ~NodesImpl() {}
   601 
   603 
   602     struct EdgeT {
   604     struct EdgeT {
   603       Edge prevOut, nextOut;
   605       Edge prevOut, nextOut;
   604       Edge prevIn, nextIn;
   606       Edge prevIn, nextIn;
   605     };
   607     };
   606     class EdgesImpl : public Graph::template EdgeMap<EdgeT> {
   608     class EdgesImpl : public DefaultMap<Graph, Edge, EdgeT> {
   607       friend class EdgeSubGraphBase;
   609       friend class EdgeSubGraphBase;
   608     public:
   610     public:
   609       typedef typename Graph::template EdgeMap<EdgeT> Parent;
   611       typedef DefaultMap<Graph, Edge, EdgeT> Parent;
   610 
   612 
   611       EdgesImpl(SubGraph& _adaptor, const Graph& _graph) 
   613       EdgesImpl(SubGraph& _adaptor, const Graph& _graph) 
   612 	: Parent(_graph), adaptor(_adaptor) {}
   614 	: Parent(_graph), adaptor(_adaptor) {}
   613 
   615 
   614       virtual ~EdgesImpl() {}
   616       virtual ~EdgesImpl() {}