COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
11/05/04 01:31:49 (19 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1345
Message:

Undirect graph implementation.
Not yet done, untested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/iterable_graph_extender.h

    r946 r962  
    99  template <typename _Base>
    1010  class IterableGraphExtender : public _Base {
     11  public:
    1112
    1213    typedef _Base Parent;
    1314    typedef IterableGraphExtender<_Base> Graph;
    14 
    15   public:
    1615
    1716    typedef typename Parent::Node Node;
     
    2726      NodeIt(Invalid i) : Node(i) { }
    2827
    29       explicit NodeIt(const Graph& _graph) : Node(), graph(&_graph) {
     28      explicit NodeIt(const Graph& _graph) : graph(&_graph) {
    3029        _graph.first(*static_cast<Node*>(this));
    3130      }
     
    5049      EdgeIt(Invalid i) : Edge(i) { }
    5150
    52       explicit EdgeIt(const Graph& _graph) : Edge(), graph(&_graph) {
     51      explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
    5352        _graph.first(*static_cast<Edge*>(this));
    5453      }
     
    7473
    7574      OutEdgeIt(const Graph& _graph, const Node& node)
    76         : Edge(), graph(&_graph) {
     75        : graph(&_graph) {
    7776        _graph.firstOut(*this, node);
    7877      }
     
    9897
    9998      InEdgeIt(const Graph& _graph, const Node& node)
    100         : Edge(), graph(&_graph) {
     99        : graph(&_graph) {
    101100        _graph.firstIn(*this, node);
    102101      }
     
    127126  };
    128127 
     128  template <typename _Base>
     129  class IterableUndirGraphExtender : public IterableGraphExtender<_Base> {
     130  public:
     131
     132    typedef IterableGraphExtender<_Base> Parent;
     133    typedef IterableUndirGraphExtender<_Base> Graph;
     134
     135    typedef typename Parent::UndirEdge UndirEdge;
     136
     137    class UndirEdgeIt : public UndirEdge {
     138      const Graph* graph;
     139    public:
     140
     141      UndirEdgeIt() { }
     142
     143      UndirEdgeIt(Invalid i) : UndirEdge(i) { }
     144
     145      explicit UndirEdgeIt(const Graph& _graph) : graph(&_graph) {
     146        _graph.first(*static_cast<UndirEdge*>(this));
     147      }
     148
     149      UndirEdgeIt(const Graph& _graph, const UndirEdge& e) :
     150        UndirEdge(e), graph(&_graph) { }
     151
     152      UndirEdgeIt& operator++() {
     153        graph->next(*this);
     154        return *this;
     155      }
     156
     157    };
     158
     159
     160  };
    129161}
    130162
Note: See TracChangeset for help on using the changeset viewer.