edge_num.h

Go to the documentation of this file.
00001 //
00002 // This program can be freely used in an academic environment
00003 // ONLY for research purposes, subject to the following restrictions:
00004 //
00005 // 1. The origin of this software must not be misrepresented; you must not
00006 //    claim that you wrote the original software. If you use this software
00007 //    an acknowledgment in the product documentation is required.
00008 // 2. Altered source versions must be plainly marked as such, and must not be
00009 //    misrepresented as being the original software.
00010 // 3. This notice may not be removed or altered from any source distribution.
00011 //
00012 // Any other use is strictly prohibited by the author, without an explicit 
00013 // permission.
00014 //
00015 // Note that this program uses the LEDA library, which is NOT free. For more 
00016 // details visit Algorithmic Solutions at http://www.algorithmic-solutions.com/
00017 // There is also a free version of LEDA 6.0 or newer.
00018 //
00019 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00020 // ! Any commercial use of this software is strictly !
00021 // ! prohibited without explicit permission by the   !
00022 // ! author.                                         !
00023 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00024 //
00025 // This software is distributed in the hope that it will be useful,
00026 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00027 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00028 //
00029 // Copyright (C) 2004-2008 - Dimitris Michail <dmixdim@googlemail.com>, <michail@mpi-inf.mpg.de>
00030 //
00031 // $Id: edge_num.h 7025 2008-04-17 15:01:11Z dmichail $ 
00032 //
00033 
00038 #ifndef EDGE_NUM_H
00039 #define EDGE_NUM_H
00040 
00041 #include <LEP/mcb/config.h>
00042 #include <vector>
00043 #ifdef LEDA_GE_V5
00044 #include <LEDA/graph/graph.h>
00045 #include <LEDA/graph/edge_array.h>
00046 #include <LEDA/graph/node_set.h>
00047 #include <LEDA/core/b_queue.h>
00048 #else
00049 #include <LEDA/graph.h>
00050 #include <LEDA/edge_array.h>
00051 #include <LEDA/node_set.h>
00052 #include <LEDA/b_queue.h>
00053 #endif
00054 
00055 namespace mcb { 
00056 
00057 
00077     class edge_num
00078     {
00079 
00080         private:
00081             // variables:
00082             int n; 
00083             int m;
00084             int k;
00085             std::vector< leda::edge > index;
00086             leda::edge_array<int> rindex;
00087             // methods:
00088             void create_numbering( const leda::graph& );
00089             int construct_tree( const leda::graph&, leda::edge_array<bool>& tree );
00090             
00091         public:
00093             edge_num();
00094 
00098             explicit edge_num ( const leda::graph& G );
00099 
00101             edge_num ( const edge_num& );
00102 
00104             ~edge_num (void);
00105 
00107             edge_num& operator=( const edge_num& );
00108 
00113             inline int operator()(leda::edge e) const { 
00114                 return rindex[e];
00115             }
00116 
00121             inline leda::edge operator()(int i) const { 
00122 #if ! defined(LEDA_CHECKING_OFF)
00123                 if ( i < 0 || i > m-1 )
00124                     leda::error_handler(999,"edge_num: illegal number requested");
00125 #endif
00126                 return index[ i ];
00127             }
00128 
00133             bool tree( leda::edge e ) const { 
00134                 return ( rindex[e] >= m - n + k );
00135             }
00136 
00142             int dim_cycle_space() const {
00143                 return m - n + k;
00144             }
00145 
00149             int num_weak_connected_comp() const {
00150                 return k;
00151             }
00152     };
00153 
00154 
00155 } // end namespace mcb
00156 
00157 #endif
00158 
00159 /* ex: set ts=4 sw=4 sts=4 et: */
00160 
00161 

Generated on Tue Apr 22 13:40:09 2008 for mcb LEDA Extension Package by  doxygen 1.4.6