diff -r 875fe3f689e0 -r d276e88aa48a lemon/graph_adaptor.h --- a/lemon/graph_adaptor.h Wed Mar 01 09:40:16 2006 +0000 +++ b/lemon/graph_adaptor.h Wed Mar 01 10:04:47 2006 +0000 @@ -1350,372 +1350,371 @@ }; - template - class SplitGraphAdaptorBase - : public GraphAdaptorBase<_Graph> { - public: - typedef GraphAdaptorBase<_Graph> Parent; +// template +// class SplitGraphAdaptorBase +// : public GraphAdaptorBase<_Graph> { +// public: +// typedef GraphAdaptorBase<_Graph> Parent; - class Node; - class Edge; - template class NodeMap; - template class EdgeMap; +// class Node; +// class Edge; +// template class NodeMap; +// template class EdgeMap; - class Node : public Parent::Node { - friend class SplitGraphAdaptorBase; - template friend class NodeMap; - typedef typename Parent::Node NodeParent; - private: +// class Node : public Parent::Node { +// friend class SplitGraphAdaptorBase; +// template friend class NodeMap; +// typedef typename Parent::Node NodeParent; +// private: - bool entry; - Node(typename Parent::Node _node, bool _entry) - : Parent::Node(_node), entry(_entry) {} +// bool entry; +// Node(typename Parent::Node _node, bool _entry) +// : Parent::Node(_node), entry(_entry) {} - public: - Node() {} - Node(Invalid) : NodeParent(INVALID), entry(true) {} +// public: +// Node() {} +// Node(Invalid) : NodeParent(INVALID), entry(true) {} - bool operator==(const Node& node) const { - return NodeParent::operator==(node) && entry == node.entry; - } +// bool operator==(const Node& node) const { +// return NodeParent::operator==(node) && entry == node.entry; +// } - bool operator!=(const Node& node) const { - return !(*this == node); - } +// bool operator!=(const Node& node) const { +// return !(*this == node); +// } - bool operator<(const Node& node) const { - return NodeParent::operator<(node) || - (NodeParent::operator==(node) && entry < node.entry); - } - }; +// bool operator<(const Node& node) const { +// return NodeParent::operator<(node) || +// (NodeParent::operator==(node) && entry < node.entry); +// } +// }; - /// \todo May we want VARIANT/union type - class Edge : public Parent::Edge { - friend class SplitGraphAdaptorBase; - template friend class EdgeMap; - private: - typedef typename Parent::Edge EdgeParent; - typedef typename Parent::Node NodeParent; - NodeParent bind; +// /// \todo May we want VARIANT/union type +// class Edge : public Parent::Edge { +// friend class SplitGraphAdaptorBase; +// template friend class EdgeMap; +// private: +// typedef typename Parent::Edge EdgeParent; +// typedef typename Parent::Node NodeParent; +// NodeParent bind; - Edge(const EdgeParent& edge, const NodeParent& node) - : EdgeParent(edge), bind(node) {} - public: - Edge() {} - Edge(Invalid) : EdgeParent(INVALID), bind(INVALID) {} +// Edge(const EdgeParent& edge, const NodeParent& node) +// : EdgeParent(edge), bind(node) {} +// public: +// Edge() {} +// Edge(Invalid) : EdgeParent(INVALID), bind(INVALID) {} - bool operator==(const Edge& edge) const { - return EdgeParent::operator==(edge) && bind == edge.bind; - } +// bool operator==(const Edge& edge) const { +// return EdgeParent::operator==(edge) && bind == edge.bind; +// } - bool operator!=(const Edge& edge) const { - return !(*this == edge); - } +// bool operator!=(const Edge& edge) const { +// return !(*this == edge); +// } - bool operator<(const Edge& edge) const { - return EdgeParent::operator<(edge) || - (EdgeParent::operator==(edge) && bind < edge.bind); - } - }; +// bool operator<(const Edge& edge) const { +// return EdgeParent::operator<(edge) || +// (EdgeParent::operator==(edge) && bind < edge.bind); +// } +// }; - void first(Node& node) const { - Parent::first(node); - node.entry = true; - } +// void first(Node& node) const { +// Parent::first(node); +// node.entry = true; +// } - void next(Node& node) const { - if (node.entry) { - node.entry = false; - } else { - node.entry = true; - Parent::next(node); - } - } +// void next(Node& node) const { +// if (node.entry) { +// node.entry = false; +// } else { +// node.entry = true; +// Parent::next(node); +// } +// } - void first(Edge& edge) const { - Parent::first(edge); - if ((typename Parent::Edge&)edge == INVALID) { - Parent::first(edge.bind); - } else { - edge.bind = INVALID; - } - } +// void first(Edge& edge) const { +// Parent::first(edge); +// if ((typename Parent::Edge&)edge == INVALID) { +// Parent::first(edge.bind); +// } else { +// edge.bind = INVALID; +// } +// } - void next(Edge& edge) const { - if ((typename Parent::Edge&)edge != INVALID) { - Parent::next(edge); - if ((typename Parent::Edge&)edge == INVALID) { - Parent::first(edge.bind); - } - } else { - Parent::next(edge.bind); - } - } +// void next(Edge& edge) const { +// if ((typename Parent::Edge&)edge != INVALID) { +// Parent::next(edge); +// if ((typename Parent::Edge&)edge == INVALID) { +// Parent::first(edge.bind); +// } +// } else { +// Parent::next(edge.bind); +// } +// } - void firstIn(Edge& edge, const Node& node) const { - if (node.entry) { - Parent::firstIn(edge, node); - edge.bind = INVALID; - } else { - (typename Parent::Edge&)edge = INVALID; - edge.bind = node; - } - } +// void firstIn(Edge& edge, const Node& node) const { +// if (node.entry) { +// Parent::firstIn(edge, node); +// edge.bind = INVALID; +// } else { +// (typename Parent::Edge&)edge = INVALID; +// edge.bind = node; +// } +// } - void nextIn(Edge& edge) const { - if ((typename Parent::Edge&)edge != INVALID) { - Parent::nextIn(edge); - } else { - edge.bind = INVALID; - } - } +// void nextIn(Edge& edge) const { +// if ((typename Parent::Edge&)edge != INVALID) { +// Parent::nextIn(edge); +// } else { +// edge.bind = INVALID; +// } +// } - void firstOut(Edge& edge, const Node& node) const { - if (!node.entry) { - Parent::firstOut(edge, node); - edge.bind = INVALID; - } else { - (typename Parent::Edge&)edge = INVALID; - edge.bind = node; - } - } +// void firstOut(Edge& edge, const Node& node) const { +// if (!node.entry) { +// Parent::firstOut(edge, node); +// edge.bind = INVALID; +// } else { +// (typename Parent::Edge&)edge = INVALID; +// edge.bind = node; +// } +// } - void nextOut(Edge& edge) const { - if ((typename Parent::Edge&)edge != INVALID) { - Parent::nextOut(edge); - } else { - edge.bind = INVALID; - } - } +// void nextOut(Edge& edge) const { +// if ((typename Parent::Edge&)edge != INVALID) { +// Parent::nextOut(edge); +// } else { +// edge.bind = INVALID; +// } +// } - Node source(const Edge& edge) const { - if ((typename Parent::Edge&)edge != INVALID) { - return Node(Parent::source(edge), false); - } else { - return Node(edge.bind, true); - } - } +// Node source(const Edge& edge) const { +// if ((typename Parent::Edge&)edge != INVALID) { +// return Node(Parent::source(edge), false); +// } else { +// return Node(edge.bind, true); +// } +// } - Node target(const Edge& edge) const { - if ((typename Parent::Edge&)edge != INVALID) { - return Node(Parent::target(edge), true); - } else { - return Node(edge.bind, false); - } - } +// Node target(const Edge& edge) const { +// if ((typename Parent::Edge&)edge != INVALID) { +// return Node(Parent::target(edge), true); +// } else { +// return Node(edge.bind, false); +// } +// } - static bool entryNode(const Node& node) { - return node.entry; - } +// static bool entryNode(const Node& node) { +// return node.entry; +// } - static bool exitNode(const Node& node) { - return !node.entry; - } +// static bool exitNode(const Node& node) { +// return !node.entry; +// } - static Node getEntry(const typename Parent::Node& node) { - return Node(node, true); - } +// static Node getEntry(const typename Parent::Node& node) { +// return Node(node, true); +// } - static Node getExit(const typename Parent::Node& node) { - return Node(node, false); - } +// static Node getExit(const typename Parent::Node& node) { +// return Node(node, false); +// } - static bool originalEdge(const Edge& edge) { - return (typename Parent::Edge&)edge != INVALID; - } +// static bool originalEdge(const Edge& edge) { +// return (typename Parent::Edge&)edge != INVALID; +// } - static bool bindingEdge(const Edge& edge) { - return edge.bind != INVALID; - } +// static bool bindingEdge(const Edge& edge) { +// return edge.bind != INVALID; +// } - static Node getBindedNode(const Edge& edge) { - return edge.bind; - } +// static Node getBindedNode(const Edge& edge) { +// return edge.bind; +// } - int nodeNum() const { - return Parent::nodeNum() * 2; - } +// int nodeNum() const { +// return Parent::nodeNum() * 2; +// } - typedef CompileTimeAnd EdgeNumTag; +// typedef True EdgeNumTag; - int edgeNum() const { - return Parent::edgeNum() + Parent::nodeNum(); - } +// int edgeNum() const { +// return countEdges() + Parent::nodeNum(); +// } - Edge findEdge(const Node& source, const Node& target, - const Edge& prev = INVALID) const { - if (exitNode(source) && entryNode(target)) { - return Parent::findEdge(source, target, prev); - } else { - if (prev == INVALID && entryNode(source) && exitNode(target) && - (typename Parent::Node&)source == (typename Parent::Node&)target) { - return Edge(INVALID, source); - } else { - return INVALID; - } - } - } +// Edge findEdge(const Node& source, const Node& target, +// const Edge& prev = INVALID) const { +// if (exitNode(source) && entryNode(target)) { +// return Parent::findEdge(source, target, prev); +// } else { +// if (prev == INVALID && entryNode(source) && exitNode(target) && +// (typename Parent::Node&)source == (typename Parent::Node&)target) { +// return Edge(INVALID, source); +// } else { +// return INVALID; +// } +// } +// } - template - class NodeMap : public MapBase { - typedef typename Parent::template NodeMap NodeImpl; - public: - NodeMap(const SplitGraphAdaptorBase& _graph) - : entry(_graph), exit(_graph) {} - NodeMap(const SplitGraphAdaptorBase& _graph, const T& t) - : entry(_graph, t), exit(_graph, t) {} +// template +// class NodeMap : public MapBase { +// typedef typename Parent::template NodeMap NodeImpl; +// public: +// NodeMap(const SplitGraphAdaptorBase& _graph) +// : entry(_graph), exit(_graph) {} +// NodeMap(const SplitGraphAdaptorBase& _graph, const T& t) +// : entry(_graph, t), exit(_graph, t) {} - void set(const Node& key, const T& val) { - if (key.entry) { entry.set(key, val); } - else {exit.set(key, val); } - } +// void set(const Node& key, const T& val) { +// if (key.entry) { entry.set(key, val); } +// else {exit.set(key, val); } +// } - typename MapTraits::ReturnValue - operator[](const Node& key) { - if (key.entry) { return entry[key]; } - else { return exit[key]; } - } +// typename MapTraits::ReturnValue +// operator[](const Node& key) { +// if (key.entry) { return entry[key]; } +// else { return exit[key]; } +// } - typename MapTraits::ConstReturnValue - operator[](const Node& key) const { - if (key.entry) { return entry[key]; } - else { return exit[key]; } - } +// typename MapTraits::ConstReturnValue +// operator[](const Node& key) const { +// if (key.entry) { return entry[key]; } +// else { return exit[key]; } +// } - private: - NodeImpl entry, exit; - }; +// private: +// NodeImpl entry, exit; +// }; - template - class EdgeMap : public MapBase { - typedef typename Parent::template NodeMap NodeImpl; - typedef typename Parent::template EdgeMap EdgeImpl; - public: - EdgeMap(const SplitGraphAdaptorBase& _graph) - : bind(_graph), orig(_graph) {} - EdgeMap(const SplitGraphAdaptorBase& _graph, const T& t) - : bind(_graph, t), orig(_graph, t) {} +// template +// class EdgeMap : public MapBase { +// typedef typename Parent::template NodeMap NodeImpl; +// typedef typename Parent::template EdgeMap EdgeImpl; +// public: +// EdgeMap(const SplitGraphAdaptorBase& _graph) +// : bind(_graph), orig(_graph) {} +// EdgeMap(const SplitGraphAdaptorBase& _graph, const T& t) +// : bind(_graph, t), orig(_graph, t) {} - void set(const Edge& key, const T& val) { - if ((typename Parent::Edge&)key != INVALID) { orig.set(key, val); } - else {bind.set(key.bind, val); } - } +// void set(const Edge& key, const T& val) { +// if ((typename Parent::Edge&)key != INVALID) { orig.set(key, val); } +// else {bind.set(key.bind, val); } +// } - typename MapTraits::ReturnValue - operator[](const Edge& key) { - if ((typename Parent::Edge&)key != INVALID) { return orig[key]; } - else {return bind[key.bind]; } - } +// typename MapTraits::ReturnValue +// operator[](const Edge& key) { +// if ((typename Parent::Edge&)key != INVALID) { return orig[key]; } +// else {return bind[key.bind]; } +// } - typename MapTraits::ConstReturnValue - operator[](const Edge& key) const { - if ((typename Parent::Edge&)key != INVALID) { return orig[key]; } - else {return bind[key.bind]; } - } +// typename MapTraits::ConstReturnValue +// operator[](const Edge& key) const { +// if ((typename Parent::Edge&)key != INVALID) { return orig[key]; } +// else {return bind[key.bind]; } +// } - private: - typename Parent::template NodeMap bind; - typename Parent::template EdgeMap orig; - }; +// private: +// typename Parent::template NodeMap bind; +// typename Parent::template EdgeMap orig; +// }; - template - class CombinedNodeMap : public MapBase { - public: - typedef MapBase Parent; +// template +// class CombinedNodeMap : public MapBase { +// public: +// typedef MapBase Parent; - typedef typename Parent::Key Key; - typedef typename Parent::Value Value; +// typedef typename Parent::Key Key; +// typedef typename Parent::Value Value; - CombinedNodeMap(EntryMap& _entryMap, ExitMap& _exitMap) - : entryMap(_entryMap), exitMap(_exitMap) {} +// CombinedNodeMap(EntryMap& _entryMap, ExitMap& _exitMap) +// : entryMap(_entryMap), exitMap(_exitMap) {} - Value& operator[](const Key& key) { - if (key.entry) { - return entryMap[key]; - } else { - return exitMap[key]; - } - } +// Value& operator[](const Key& key) { +// if (key.entry) { +// return entryMap[key]; +// } else { +// return exitMap[key]; +// } +// } - Value operator[](const Key& key) const { - if (key.entry) { - return entryMap[key]; - } else { - return exitMap[key]; - } - } +// Value operator[](const Key& key) const { +// if (key.entry) { +// return entryMap[key]; +// } else { +// return exitMap[key]; +// } +// } - void set(const Key& key, const Value& value) { - if (key.entry) { - entryMap.set(key, value); - } else { - exitMap.set(key, value); - } - } +// void set(const Key& key, const Value& value) { +// if (key.entry) { +// entryMap.set(key, value); +// } else { +// exitMap.set(key, value); +// } +// } - private: +// private: - EntryMap& entryMap; - ExitMap& exitMap; +// EntryMap& entryMap; +// ExitMap& exitMap; - }; +// }; - template - class CombinedEdgeMap : public MapBase { - public: - typedef MapBase Parent; +// template +// class CombinedEdgeMap : public MapBase { +// public: +// typedef MapBase Parent; - typedef typename Parent::Key Key; - typedef typename Parent::Value Value; +// typedef typename Parent::Key Key; +// typedef typename Parent::Value Value; - CombinedEdgeMap(EdgeMap& _edgeMap, NodeMap& _nodeMap) - : edgeMap(_edgeMap), nodeMap(_nodeMap) {} +// CombinedEdgeMap(EdgeMap& _edgeMap, NodeMap& _nodeMap) +// : edgeMap(_edgeMap), nodeMap(_nodeMap) {} - void set(const Edge& edge, const Value& val) { - if (SplitGraphAdaptorBase::originalEdge(edge)) { - edgeMap.set(edge, val); - } else { - nodeMap.set(SplitGraphAdaptorBase::bindedNode(edge), val); - } - } +// void set(const Edge& edge, const Value& val) { +// if (SplitGraphAdaptorBase::originalEdge(edge)) { +// edgeMap.set(edge, val); +// } else { +// nodeMap.set(SplitGraphAdaptorBase::bindedNode(edge), val); +// } +// } - Value operator[](const Key& edge) const { - if (SplitGraphAdaptorBase::originalEdge(edge)) { - return edgeMap[edge]; - } else { - return nodeMap[SplitGraphAdaptorBase::bindedNode(edge)]; - } - } +// Value operator[](const Key& edge) const { +// if (SplitGraphAdaptorBase::originalEdge(edge)) { +// return edgeMap[edge]; +// } else { +// return nodeMap[SplitGraphAdaptorBase::bindedNode(edge)]; +// } +// } - Value& operator[](const Key& edge) { - if (SplitGraphAdaptorBase::originalEdge(edge)) { - return edgeMap[edge]; - } else { - return nodeMap[SplitGraphAdaptorBase::bindedNode(edge)]; - } - } +// Value& operator[](const Key& edge) { +// if (SplitGraphAdaptorBase::originalEdge(edge)) { +// return edgeMap[edge]; +// } else { +// return nodeMap[SplitGraphAdaptorBase::bindedNode(edge)]; +// } +// } - private: - EdgeMap& edgeMap; - NodeMap& nodeMap; - }; +// private: +// EdgeMap& edgeMap; +// NodeMap& nodeMap; +// }; - }; +// }; - template - class SplitGraphAdaptor - : public GraphAdaptorExtender > { - public: - typedef GraphAdaptorExtender > Parent; +// template +// class SplitGraphAdaptor +// : public GraphAdaptorExtender > { +// public: +// typedef GraphAdaptorExtender > Parent; - SplitGraphAdaptor(_Graph& graph) { - Parent::setGraph(graph); - } +// SplitGraphAdaptor(_Graph& graph) { +// Parent::setGraph(graph); +// } - }; +// }; } //namespace lemon