00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
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
00082 int n;
00083 int m;
00084 int k;
00085 std::vector< leda::edge > index;
00086 leda::edge_array<int> rindex;
00087
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 }
00156
00157 #endif
00158
00159
00160
00161