More query functions
authordeba
Wed, 07 Mar 2007 11:57:51 +0000
changeset 2399ccf2a1fa1821
parent 2398 99b999e7b775
child 2400 b199ded24c19
More query functions
lemon/steiner.h
     1.1 --- a/lemon/steiner.h	Wed Mar 07 11:57:23 2007 +0000
     1.2 +++ b/lemon/steiner.h	Wed Mar 07 11:57:51 2007 +0000
     1.3 @@ -126,6 +126,8 @@
     1.4      FilterMap *_filter;
     1.5      TreeMap *_tree;
     1.6  
     1.7 +    Value _value;
     1.8 +
     1.9    public:
    1.10  
    1.11      /// \brief Constructor
    1.12 @@ -247,7 +249,7 @@
    1.13          }
    1.14        }
    1.15  
    1.16 -      prim(nodeSubUGraphAdaptor(_graph, *_filter), _cost, *_tree);
    1.17 +      _value = prim(nodeSubUGraphAdaptor(_graph, *_filter), _cost, *_tree);
    1.18              
    1.19      }
    1.20  
    1.21 @@ -268,8 +270,34 @@
    1.22      bool tree(Node n){
    1.23        return (*_filter)[n];
    1.24      }
    1.25 +
    1.26 +    /// \brief Checks if the node is a Steiner-node.
    1.27 +    ///
    1.28 +    /// Checks if the node is a Steiner-node (i.e. a tree node but
    1.29 +    /// not terminal).
    1.30 +    /// \param n is the node that will be checked
    1.31 +    /// \return \c true if n is a Steiner-node, \c false otherwise
    1.32 +    bool steiner(Node n){
    1.33 +      return (*_filter)[n] && (*_pred)[n] != INVALID;
    1.34 +    }
    1.35 +
    1.36 +    /// \brief Checks if the node is a terminal.
    1.37 +    ///
    1.38 +    /// Checks if the node is a terminal.
    1.39 +    /// \param n is the node that will be checked
    1.40 +    /// \return \c true if n is a terminal, \c false otherwise
    1.41 +    bool terminal(Node n){
    1.42 +      return _dijkstra.reached(n) && (*_pred)[n] == INVALID;
    1.43 +    }
    1.44      
    1.45 -
    1.46 +    /// \brief The total cost of the tree
    1.47 +    ///
    1.48 +    /// The total cost of the constructed tree. The calculated value does
    1.49 +    /// not exceed the double of the optimal value.
    1.50 +    Value treeValue() const {
    1.51 +      return _value;
    1.52 +    }
    1.53 +    
    1.54    };
    1.55  
    1.56  } //END OF NAMESPACE LEMON