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
00034
00035
00036
00037
00038
00039
00040
00116 #ifndef cxx_graph_INCLUDED
00117 #define cxx_graph_INCLUDED "cxx_graph.h"
00118
00119 #ifdef _KEEP_RCS_ID
00120 static char *cxx_graph_rcs_id = cxx_graph_INCLUDED "$Revision: 1.6 $";
00121 #endif
00122
00123 #ifndef defs_INCLUDED
00124 #include "defs.h"
00125 #endif
00126
00127 typedef mUINT16 VINDEX16;
00128 typedef mUINT16 EINDEX16;
00129
00130 extern const VINDEX16 INVALID_VINDEX16;
00131 extern VINDEX16 GRAPH16_CAPACITY;
00132
00133 #ifndef graph_template_INCLUDED
00134 #include "graph_template.h"
00135 #endif
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150 class VERTEX16 {
00151 friend class DIRECTED_GRAPH16<class EDGE16, class VERTEX16>;
00152 friend class DIRECTED_GRAPH16<class ARRAY_EDGE16,class ARRAY_VERTEX16>;
00153 friend class DIRECTED_GRAPH16<class LAT_EDGE16,class LAT_VERTEX16>;
00154 friend class DIRECTED_GRAPH16<class TEDGE,class TVERTEX>;
00155 friend class DIRECTED_GRAPH16<class FB_EDGE, class FB_NODE>;
00156 private:
00157 EINDEX16 _from;
00158
00159 EINDEX16 _to;
00160
00161
00162
00163 VERTEX16(const VERTEX16&);
00164
00165 protected:
00166 void Set_Next_Free_Vertex(VINDEX16 i){ _from = i; }
00167 void Set_To_Free() { _to = INVALID_VINDEX16; }
00168 BOOL Is_Free() const { return _to == INVALID_VINDEX16; }
00169 VINDEX16 Get_Next_Free_Vertex() const { return _from; }
00170 void Set_Out_Edge(EINDEX16 i) { _from = i; }
00171 void Set_In_Edge(EINDEX16 i) { _to = i; }
00172
00173 public:
00174 VERTEX16() { _from = 0; _to = 0; }
00175 ~VERTEX16() {};
00176
00177 VERTEX16& operator = (const VERTEX16&);
00178
00179 EINDEX16 Get_In_Edge() const { return _to; }
00180
00181 EINDEX16 Get_Out_Edge() const { return _from; }
00182
00183 };
00184
00185 class EDGE16 {
00186 friend class DIRECTED_GRAPH16<class EDGE16,class VERTEX16>;
00187 friend class DIRECTED_GRAPH16<class ARRAY_EDGE16,class ARRAY_VERTEX16>;
00188 friend class DIRECTED_GRAPH16<class LAT_EDGE16,class LAT_VERTEX16>;
00189 friend class DIRECTED_GRAPH16<class TEDGE,class TVERTEX>;
00190 friend class DIRECTED_GRAPH16<class FB_EDGE, class FB_NODE>;
00191 friend class SCC_DIRECTED_GRAPH16;
00192 private:
00193
00194 VINDEX16 _from;
00195 VINDEX16 _to;
00196 EINDEX16 _nfrom;
00197 EINDEX16 _nto;
00198
00199 EDGE16(const EDGE16&);
00200
00201 protected:
00202 void Set_Source(VINDEX16 i) { _from = i; }
00203 void Set_Sink(VINDEX16 i) { _to = i; }
00204 void Set_Next_Out_Edge(EINDEX16 i) { _nfrom = i; }
00205 void Set_Next_In_Edge(EINDEX16 i) { _nto = i; }
00206 void Set_Next_Free_Edge(EINDEX16 i) { _from = i; }
00207 void Set_To_Free() { _to = INVALID_VINDEX16; }
00208 BOOL Is_Free() const { return _to == INVALID_VINDEX16; }
00209 VINDEX16 Get_Next_Free_Edge() const { return _from; }
00210 EINDEX16 Get_Next_Out_Edge() const { return _nfrom; }
00211 EINDEX16 Get_Next_In_Edge() const { return _nto; }
00212 public:
00213 EDGE16() { _from=_to=_nfrom=_nto=0; }
00214 ~EDGE16() {}
00215
00216 EDGE16& operator = (const EDGE16&);
00217
00218 VINDEX16 Get_Source() const { return _from; }
00219 VINDEX16 Get_Sink() const { return _to; }
00220 };
00221
00222 #endif // cxx_graph_INCLUDED
00223