[Lemon-commits] deba: r3231 - lemon/trunk/lemon

Lemon SVN svn at lemon.cs.elte.hu
Wed Mar 7 12:57:52 CET 2007


Author: deba
Date: Wed Mar  7 12:57:51 2007
New Revision: 3231

Modified:
   lemon/trunk/lemon/steiner.h

Log:
More query functions



Modified: lemon/trunk/lemon/steiner.h
==============================================================================
--- lemon/trunk/lemon/steiner.h	(original)
+++ lemon/trunk/lemon/steiner.h	Wed Mar  7 12:57:51 2007
@@ -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



More information about the Lemon-commits mailing list