lemon/bits/graph_extender.h
changeset 1130 0759d974de81
parent 1092 dceba191c00d
     1.1 --- a/lemon/bits/graph_extender.h	Thu Apr 02 22:34:03 2015 +0200
     1.2 +++ b/lemon/bits/graph_extender.h	Sun Jan 05 22:24:56 2014 +0100
     1.3 @@ -27,6 +27,8 @@
     1.4  #include <lemon/concept_check.h>
     1.5  #include <lemon/concepts/maps.h>
     1.6  
     1.7 +#include <lemon/bits/stl_iterators.h>
     1.8 +
     1.9  //\ingroup graphbits
    1.10  //\file
    1.11  //\brief Extenders for the graph types
    1.12 @@ -116,6 +118,10 @@
    1.13  
    1.14      };
    1.15  
    1.16 +    LemonRangeWrapper1<NodeIt, Digraph> nodes() const {
    1.17 +      return LemonRangeWrapper1<NodeIt, Digraph>(*this);
    1.18 +    }
    1.19 +
    1.20  
    1.21      class ArcIt : public Arc {
    1.22        const Digraph* _digraph;
    1.23 @@ -139,6 +145,10 @@
    1.24  
    1.25      };
    1.26  
    1.27 +    LemonRangeWrapper1<ArcIt, Digraph> arcs() const {
    1.28 +      return LemonRangeWrapper1<ArcIt, Digraph>(*this);
    1.29 +    }
    1.30 +
    1.31  
    1.32      class OutArcIt : public Arc {
    1.33        const Digraph* _digraph;
    1.34 @@ -163,6 +173,10 @@
    1.35  
    1.36      };
    1.37  
    1.38 +    LemonRangeWrapper2<OutArcIt, Digraph, Node> outArcs(const Node& u) const {
    1.39 +      return LemonRangeWrapper2<OutArcIt, Digraph, Node>(*this, u);
    1.40 +    }
    1.41 +
    1.42  
    1.43      class InArcIt : public Arc {
    1.44        const Digraph* _digraph;
    1.45 @@ -187,6 +201,10 @@
    1.46  
    1.47      };
    1.48  
    1.49 +    LemonRangeWrapper2<InArcIt, Digraph, Node> inArcs(const Node& u) const {
    1.50 +      return LemonRangeWrapper2<InArcIt, Digraph, Node>(*this, u);
    1.51 +    }
    1.52 +
    1.53      // \brief Base node of the iterator
    1.54      //
    1.55      // Returns the base node (i.e. the source in this case) of the iterator
    1.56 @@ -436,6 +454,10 @@
    1.57  
    1.58      };
    1.59  
    1.60 +    LemonRangeWrapper1<NodeIt, Graph> nodes() const {
    1.61 +      return LemonRangeWrapper1<NodeIt, Graph>(*this);
    1.62 +    }
    1.63 +
    1.64  
    1.65      class ArcIt : public Arc {
    1.66        const Graph* _graph;
    1.67 @@ -459,6 +481,10 @@
    1.68  
    1.69      };
    1.70  
    1.71 +    LemonRangeWrapper1<ArcIt, Graph> arcs() const {
    1.72 +      return LemonRangeWrapper1<ArcIt, Graph>(*this);
    1.73 +    }
    1.74 +
    1.75  
    1.76      class OutArcIt : public Arc {
    1.77        const Graph* _graph;
    1.78 @@ -483,6 +509,10 @@
    1.79  
    1.80      };
    1.81  
    1.82 +    LemonRangeWrapper2<OutArcIt, Graph, Node> outArcs(const Node& u) const {
    1.83 +      return LemonRangeWrapper2<OutArcIt, Graph, Node>(*this, u);
    1.84 +    }
    1.85 +
    1.86  
    1.87      class InArcIt : public Arc {
    1.88        const Graph* _graph;
    1.89 @@ -507,6 +537,10 @@
    1.90  
    1.91      };
    1.92  
    1.93 +    LemonRangeWrapper2<InArcIt, Graph, Node> inArcs(const Node& u) const {
    1.94 +      return LemonRangeWrapper2<InArcIt, Graph, Node>(*this, u);
    1.95 +    }
    1.96 +
    1.97  
    1.98      class EdgeIt : public Parent::Edge {
    1.99        const Graph* _graph;
   1.100 @@ -530,6 +564,11 @@
   1.101  
   1.102      };
   1.103  
   1.104 +    LemonRangeWrapper1<EdgeIt, Graph> edges() const {
   1.105 +      return LemonRangeWrapper1<EdgeIt, Graph>(*this);
   1.106 +    }
   1.107 +
   1.108 +
   1.109      class IncEdgeIt : public Parent::Edge {
   1.110        friend class GraphExtender;
   1.111        const Graph* _graph;
   1.112 @@ -555,6 +594,11 @@
   1.113        }
   1.114      };
   1.115  
   1.116 +    LemonRangeWrapper2<IncEdgeIt, Graph, Node> incEdges(const Node& u) const {
   1.117 +      return LemonRangeWrapper2<IncEdgeIt, Graph, Node>(*this, u);
   1.118 +    }
   1.119 +
   1.120 +
   1.121      // \brief Base node of the iterator
   1.122      //
   1.123      // Returns the base node (ie. the source in this case) of the iterator
   1.124 @@ -903,6 +947,11 @@
   1.125  
   1.126      };
   1.127  
   1.128 +    LemonRangeWrapper1<NodeIt, BpGraph> nodes() const {
   1.129 +      return LemonRangeWrapper1<NodeIt, BpGraph>(*this);
   1.130 +    }
   1.131 +
   1.132 +
   1.133      class RedNodeIt : public RedNode {
   1.134        const BpGraph* _graph;
   1.135      public:
   1.136 @@ -925,6 +974,11 @@
   1.137  
   1.138      };
   1.139  
   1.140 +    LemonRangeWrapper1<RedNodeIt, BpGraph> redNodes() const {
   1.141 +      return LemonRangeWrapper1<RedNodeIt, BpGraph>(*this);
   1.142 +    }
   1.143 +
   1.144 +
   1.145      class BlueNodeIt : public BlueNode {
   1.146        const BpGraph* _graph;
   1.147      public:
   1.148 @@ -947,6 +1001,11 @@
   1.149  
   1.150      };
   1.151  
   1.152 +    LemonRangeWrapper1<BlueNodeIt, BpGraph> blueNodes() const {
   1.153 +      return LemonRangeWrapper1<BlueNodeIt, BpGraph>(*this);
   1.154 +    }
   1.155 +
   1.156 +
   1.157  
   1.158      class ArcIt : public Arc {
   1.159        const BpGraph* _graph;
   1.160 @@ -970,6 +1029,10 @@
   1.161  
   1.162      };
   1.163  
   1.164 +    LemonRangeWrapper1<ArcIt, BpGraph> arcs() const {
   1.165 +      return LemonRangeWrapper1<ArcIt, BpGraph>(*this);
   1.166 +    }
   1.167 +
   1.168  
   1.169      class OutArcIt : public Arc {
   1.170        const BpGraph* _graph;
   1.171 @@ -994,6 +1057,10 @@
   1.172  
   1.173      };
   1.174  
   1.175 +    LemonRangeWrapper2<OutArcIt, BpGraph, Node> outArcs(const Node& u) const {
   1.176 +      return LemonRangeWrapper2<OutArcIt, BpGraph, Node>(*this, u);
   1.177 +    }
   1.178 +
   1.179  
   1.180      class InArcIt : public Arc {
   1.181        const BpGraph* _graph;
   1.182 @@ -1018,6 +1085,10 @@
   1.183  
   1.184      };
   1.185  
   1.186 +    LemonRangeWrapper2<InArcIt, BpGraph, Node> inArcs(const Node& u) const {
   1.187 +      return LemonRangeWrapper2<InArcIt, BpGraph, Node>(*this, u);
   1.188 +    }
   1.189 +
   1.190  
   1.191      class EdgeIt : public Parent::Edge {
   1.192        const BpGraph* _graph;
   1.193 @@ -1041,6 +1112,11 @@
   1.194  
   1.195      };
   1.196  
   1.197 +    LemonRangeWrapper1<EdgeIt, BpGraph> edges() const {
   1.198 +      return LemonRangeWrapper1<EdgeIt, BpGraph>(*this);
   1.199 +    }
   1.200 +
   1.201 +
   1.202      class IncEdgeIt : public Parent::Edge {
   1.203        friend class BpGraphExtender;
   1.204        const BpGraph* _graph;
   1.205 @@ -1066,6 +1142,11 @@
   1.206        }
   1.207      };
   1.208  
   1.209 +    LemonRangeWrapper2<IncEdgeIt, BpGraph, Node> incEdges(const Node& u) const {
   1.210 +      return LemonRangeWrapper2<IncEdgeIt, BpGraph, Node>(*this, u);
   1.211 +    }
   1.212 +
   1.213 +
   1.214      // \brief Base node of the iterator
   1.215      //
   1.216      // Returns the base node (ie. the source in this case) of the iterator