title
Graph Drawing Toolkit

An object-oriented C++ library for handling and drawing graphs

rm3_global.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 +
00003 +  rm3_global.h
00004 +
00005 +  This file is part of GDToolkit. It can be
00006 +  used free of charge in academic research and teaching.
00007 +  Any direct or indirect commercial use of this software is illegal
00008 +  without a written authorization of
00009 +  the Dipartimento di Informatica e Automazione
00010 +  Universita' di Roma Tre, Roma, ITALIA
00011 +
00012 +
00013 *******************************************************************************/
00014 
00017 #ifndef RM3_GLOBAL_H
00018 #define RM3_GLOBAL_H
00019 
00020 #if !defined(ROOT_INCL_ID)
00021 #define ROOT_INCL_ID 34010
00022 #endif
00023 
00024 
00025 #include <string>
00026 #include <GDT/gdtarray.h>
00027 #include <GDT/gdtlist.h>
00028 #include <GDT/gdtmap.h>
00029 
00030 
00031 //-----------------------------------------------------------------------------
00032 // Windows compatibility definition for dynamic library export
00033 //-----------------------------------------------------------------------------
00034 
00035 /*
00036 #ifdef _WIN32
00037 #ifdef __DLL__
00038 #define GDT_NONSTANDARD_DECL __export
00039 #define GDT_NONSTANDARD_DECL_FUNCTION __declspec(dllexport)
00040 #else                                                      
00041 #define GDT_NONSTANDARD_DECL __import                      
00042 #define GDT_NONSTANDARD_DECL_FUNCTION __declspec(dllimport)
00043 #endif
00044 #else
00045 #define GDT_NONSTANDARD_DECL
00046 #define GDT_NONSTANDARD_DECL_FUNCTION 
00047 #endif
00048 */
00049 
00050 #define GDT_NONSTANDARD_DECL
00051 #define GDT_NONSTANDARD_DECL_FUNCTION 
00052 
00053 
00054 
00055 //-----------------------------------------------------------------------------
00056 // gloabl: global definitions for the rm3 files
00057 //
00058 // W.Didimo e A.Leonforte (1996)
00059 //-----------------------------------------------------------------------------
00060 
00061 // some compilers (e.g MVC 6.0) defines INFINITE
00062 #ifdef INFINITE
00063 #undef INFINITE
00064 #endif
00065 extern const int INFINITE;
00066 extern const int BOUND_ON_NODES;
00067 
00068 #define gdt_minimum(a,b) ((a)>(b) ? (b) : (a))
00069 #define gdt_maximum(a,b) ((a)>(b) ? (a) : (b))
00070 
00071 #define safe_delete(a) {delete(a); a = NULL;}
00072 
00073 //typedef gdt::gdtlist<int> int_perm;
00074 
00075 
00076 // -------------------------------------------------
00077 // list of possible algorithms to apply in GDToolkit
00078 // -------------------------------------------------
00079 
00080         typedef enum
00081         {
00082         DEFAULT_ALGORITHM,
00083 
00084         PLAN_ORTH_QUICK,
00085         PLAN_ORTH_OPTIMAL,
00086         PLAN_ORTH_SLOW,
00087         PLAN_ORTH_UPWA_STRAIGHT_MIDDLE,
00088 
00089         // Described in:
00090         //
00091         //   A. Papakostas and I.G. Tollis,
00092         //   "Efficient Orthogonal Drawings of High Degree Graphs"
00093         //   Algorithmica (2000) 26: 100-125.
00094         //
00095         // Code is in the file rel_coord_orth.cpp
00096         // see also the corresponding draw_undi constructor
00097         //
00098         ORTH_SIMPLE_PT00,
00099 
00100         // Code in _rm3_draw_undi_graph.cpp
00101         //
00102         ORTH_FROM_VISIBILITY,
00103         ORTH_FROM_VISIBILITY_COMPACTED,
00104 
00105         TREE_DRAW_CENTERSONS,
00106         TREE_DRAW_CENTERSUBTREE,
00107 
00108         VISIBILITY,
00109         VISIBILITY_COMPACTED,
00110         VISIBILITY_REGULAR,
00111         VISIBILITY_REGULAR_COMPACTED,
00112 
00113         POLYLINE,
00114         POLYLINE_COMPACTED,
00115         POLYLINE_REGULAR,
00116         POLYLINE_REGULAR_COMPACTED,
00117         
00118         PLAN_UPWARD_OPTIMAL,
00119         PLAN_UPWARD_SLOW,
00120         PLAN_UPWARD_EMBEDDING,
00121         PLAN_UPWARD_EMBEDDING_REGULAR,
00122         
00123         FAST_COMPACTION,
00124         FAST_COMPACTION_REFINED,
00125         SLOW_COMPACTION,
00126         SLOW_COMPACTION_REFINED,        
00127         FAST_REGULAR_COMPACTION_1,
00128         SLOW_REGULAR_COMPACTION_1,
00129         FAST_REGULAR_COMPACTION_2,
00130         SLOW_REGULAR_COMPACTION_2,
00131         FAST_REGULAR_COMPACTION_1_REFINED,
00132         SLOW_REGULAR_COMPACTION_1_REFINED,
00133         FAST_REGULAR_COMPACTION_2_REFINED,
00134         SLOW_REGULAR_COMPACTION_2_REFINED
00135         }
00136 algorithm_type;
00137 
00138 
00139 // ------------------------------------------
00140 // structure used in Branch and Bound methods
00141 // ------------------------------------------
00142 
00143         typedef struct 
00144         {
00145         int             number_of_total_nodes;          // number of total nodes in the Branch and Bound tree
00146         int             number_of_cut_nodes;            // number of cut nodes by B&B algorithm
00147         int             number_of_visited_nodes;        // number of visited nodes by B&B algorithm
00148         int             number_of_cuts;                 // number of total cuts executed by B&B algorithm       
00149         gdt::gdtmap<int,int>    N;                      // N(i) = number of nodes of a B&B subtree rooted to depth i
00150         }
00151 BB_tree_parameters;
00152  
00153 
00154 // ----------------------
00155 // Generic used functions
00156 // ----------------------
00157 
00158 GDT_NONSTANDARD_DECL_FUNCTION int               random (int a, int b);          // return a randomly generated integer number between a and b
00159 GDT_NONSTANDARD_DECL_FUNCTION int               fact   (int n);                 // return the factorial of the integer n
00160 //array<int_perm> find_all_permutations (int n);        // compute the ordered set of all permutations
00161 GDT_NONSTANDARD_DECL_FUNCTION gdt::gdtarray< gdt::gdtlist<int> > find_all_permutations (int n); // compute the ordered set of all permutations
00162                                                 // over the set {0,1,2,..,n-1}. ([0] <-> {0,1,2,..,n-1})..([(n-1)!]<-> {n-1,n-2,..,0})
00163 
00164 
00165 // -----------
00166 // Marker type
00167 // -----------
00168 
00169         typedef enum
00170         {
00171         RM3_UNDEFINED_MARKER,
00172         RM3_REPLACES_A_BEND,
00173         RM3_ADDED_BY_RECTANGULARIZATION,
00174         RM3_CROSS_ON_REAL_EDGE,
00175         RM3_DD_CROSS_ON_FACE,
00176         RM3_DD_CROSS_ON_REAL_EDGE,
00177         RM3_DD_CROSS_ON_DUMMY_EDGE,
00178         RM3_DD_WALK_ALONG_DUMMY_EDGE,
00179         RM3_DD_WALK_ALONG_REAL_EDGE,
00180         RM3_DD_WALK_AND_TURN_LEFT_ALONG_DUMMY_EDGE,
00181         RM3_DD_WALK_AND_TURN_RIGHT_ALONG_DUMMY_EDGE,
00182         RM3_DD_WALK_AND_TURN_LEFT_ALONG_REAL_EDGE,
00183         RM3_DD_WALK_AND_TURN_RIGHT_ALONG_REAL_EDGE,
00184         RM3_DD_WALK_AND_TURN_LEFT_ALONG_EAGLE_BOUNDARY_EDGE,
00185         RM3_DD_WALK_AND_TURN_RIGHT_ALONG_EAGLE_BOUNDARY_EDGE,
00186         RM3_DD_TURN_LEFT_AND_WALK_ALONG_DUMMY_EDGE,
00187         RM3_DD_TURN_RIGHT_AND_WALK_ALONG_DUMMY_EDGE,
00188         RM3_DD_TURN_LEFT_AND_WALK_ALONG_REAL_EDGE,
00189         RM3_DD_TURN_RIGHT_AND_WALK_ALONG_REAL_EDGE,
00190         RM3_DD_TURN_LEFT_AND_WALK_ALONG_EAGLE_BOUNDARY_EDGE,
00191         RM3_DD_TURN_RIGHT_AND_WALK_ALONG_EAGLE_BOUNDARY_EDGE,
00192         RM3_DD_ACROSS_A_NODE,
00193         RM3_DD_ACROSS_A_REPLACES_A_BEND_BETWEEN_FRONT_AND_LEFT_REAL_EDGES,
00194         RM3_DD_ACROSS_A_REPLACES_A_BEND_BETWEEN_FRONT_AND_RIGHT_REAL_EDGES,
00195         RM3_DD_ACROSS_A_REPLACES_A_BEND_BETWEEN_BACK_AND_LEFT_REAL_EDGES,
00196         RM3_DD_ACROSS_A_REPLACES_A_BEND_BETWEEN_BACK_AND_RIGHT_REAL_EDGES,
00197         RM3_DD_TURN_LEFT_ON_NODE,
00198         RM3_DD_TURN_RIGHT_ON_NODE,
00199         RM3_DD_TURN_LEFT_ON_NODE_FROM_DUMMY_TO_REAL,
00200         RM3_DD_TURN_RIGHT_ON_NODE_FROM_DUMMY_TO_REAL,
00201         RM3_DD_TURN_LEFT_ON_NODE_FROM_REAL_TO_DUMMY,
00202         RM3_DD_TURN_RIGHT_ON_NODE_FROM_REAL_TO_DUMMY,
00203         //RM3_DD_TURN_LEFT_ON_A_REPLACES_A_BEND_NODE,  disabled because of the "no walk on REPLACES_A_BEND gdtnode problem"
00204         //RM3_DD_TURN_RIGHT_ON_A_REPLACES_A_BEND_NODE, disabled because of the "no walk on REPLACES_A_BEND gdtnode problem"
00205         RM3_DD_CROSS_ON_DUMMY_NODE_BETWEEN_REAL_EDGES,
00206         RM3_DD_CROSS_ON_DUMMY_NODE_BETWEEN_DUMMY_EDGES,
00207         RM3_ADDED_BY_MAKE_UPWARD,
00208         RM3_ADDED_BY_MAKE_ST,
00209         RM3_ADDED_BY_MAKE_SIMPLE,
00210         RM3_ADDED_BY_MAKE_CONNECTED,
00211         RM3_ADDED_BY_EXPAND,
00212         RM3_BEND_NODE,
00213         RM3_ANY_BEND,
00214         RM3_NONE_BEND,
00215         RM3_MINIMAL_BEND,
00216         RM3_PLANARIZATION_GADGET_NODE,
00217         RM3_PLANARIZATION_GADGET_EDGE,
00218         RM3_ADDED_BY_REGULARIZATION,
00219         RM3_NODE_IN_SUPER_NODE,
00220         RM3_CENTER_OF_WHEEL
00221         }
00222 marker_type; 
00223 
00224 
00225 
00226         /*
00227         GLOBALTYPE angle_type
00228         Different kind of angle.
00229         Allowed values: _000=0, _090=1, _180=2,
00230         _270=3, and _360=4.
00231         */
00232 
00233         typedef enum
00234         {
00235         _000=0,
00236         _090=1,
00237         _180=2,
00238         _270=3,
00239         _360=4
00240         }
00241 angle_type;
00242 
00243 
00244 
00245 
00246 inline  std::ostream& operator <<(std::ostream& out,const marker_type x)
00247      {out << *((unsigned int *)((void *)&x)) ;return(out);}
00248 inline  std::istream& operator >>(std::istream& in,marker_type& x)
00249      {in >> *((unsigned int *)((void *)&x)) ;return(in); }
00250 
00251 
00252 /* Forward declaration need to allow rm3_constraints.h to work.*/
00253 
00254 class undi_graph;
00255 class struct_gdtnode;
00256 class struct_gdtedge;
00257 
00258 typedef struct_gdtnode *gdtnode;
00259 typedef struct_gdtedge *gdtedge;
00260 
00261 
00262 
00264 //String manipulation
00266 
00267 
00268                 std::string
00269         replace_all(std::string s,std::string s1, std::string s2);
00270         
00271         std::string
00272 gdt_itoa
00273         (
00274         int n
00275         );
00276 
00277 
00278 
00280 // Check date and time
00282 
00283 
00284         bool
00285         check_date();
00286 
00287 
00288 
00289 #endif

Generated on Thu Jan 10 14:48:01 2008 for GDToolkit GAPI by  doxygen 1.5.3