COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
11/28/04 17:30:10 (16 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1412
Message:

UndirGraph? implementation nearly complete

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/extendable_graph_extender.h

    r980 r1022  
    3030  };
    3131
     32  template <typename _Base>
     33  class ExtendableUndirGraphExtender : public _Base {
     34  public:
     35
     36    typedef ExtendableUndirGraphExtender Graph;
     37    typedef _Base Parent;
     38
     39    typedef typename Parent::Node Node;
     40    typedef typename Parent::Edge Edge;
     41    typedef typename Parent::UndirEdge UndirEdge;
     42
     43    Node addNode() {
     44      Node node = Parent::addNode();
     45      Parent::getObserverRegistry(Node()).add(node);
     46      return node;
     47    }
     48
     49    UndirEdge addEdge(const Node& from, const Node& to) {
     50      UndirEdge uedge = Parent::addEdge(from, to);
     51      Parent::getObserverRegistry(UndirEdge()).add(uedge);
     52
     53      Edge edge_forward(uedge, true);
     54      Edge edge_backward(uedge, false);
     55      Parent::getObserverRegistry(Edge()).add(edge_forward);
     56      Parent::getObserverRegistry(Edge()).add(edge_backward);
     57
     58      return uedge;
     59    }
     60
     61  };
     62
    3263}
    3364
Note: See TracChangeset for help on using the changeset viewer.