# HG changeset patch # User deba # Date 1173268671 0 # Node ID ccf2a1fa1821ecf77a500e9d75cf589789ca12f9 # Parent 99b999e7b7751e0a8f200df6755839b15fb83817 More query functions diff -r 99b999e7b775 -r ccf2a1fa1821 lemon/steiner.h --- a/lemon/steiner.h Wed Mar 07 11:57:23 2007 +0000 +++ b/lemon/steiner.h Wed Mar 07 11:57:51 2007 +0000 @@ -126,6 +126,8 @@ FilterMap *_filter; TreeMap *_tree; + Value _value; + public: /// \brief Constructor @@ -247,7 +249,7 @@ } } - prim(nodeSubUGraphAdaptor(_graph, *_filter), _cost, *_tree); + _value = prim(nodeSubUGraphAdaptor(_graph, *_filter), _cost, *_tree); } @@ -268,8 +270,34 @@ bool tree(Node n){ return (*_filter)[n]; } + + /// \brief Checks if the node is a Steiner-node. + /// + /// Checks if the node is a Steiner-node (i.e. a tree node but + /// not terminal). + /// \param n is the node that will be checked + /// \return \c true if n is a Steiner-node, \c false otherwise + bool steiner(Node n){ + return (*_filter)[n] && (*_pred)[n] != INVALID; + } + + /// \brief Checks if the node is a terminal. + /// + /// Checks if the node is a terminal. + /// \param n is the node that will be checked + /// \return \c true if n is a terminal, \c false otherwise + bool terminal(Node n){ + return _dijkstra.reached(n) && (*_pred)[n] == INVALID; + } - + /// \brief The total cost of the tree + /// + /// The total cost of the constructed tree. The calculated value does + /// not exceed the double of the optimal value. + Value treeValue() const { + return _value; + } + }; } //END OF NAMESPACE LEMON