Main Page | Alphabetical List | Class List | File List | Class Members | File Members

barycentering2.c

Go to the documentation of this file.
00001 
00002 void barycentering (void)
00003 {
00004     int alt; 
00005     int cross; 
00006     int changed; 
00007     int tmp_startlevel, alt_startlevel; 
00008     tmp_startlevel = alt_startlevel = 0; 
00009     changed = 1; 
00010     while (phase1_allowed && changed) 
00011     { 
00012         nr_bary_iterations++; 
00013         if (nr_bary_iterations >= max_baryiterations) 
00014         { 
00015             gs_wait_message ('t'); 
00016             break; 
00017         } 
00018         if (G_timelimit > 0) if (test_timelimit (60))  
00019         { 
00020             gs_wait_message ('t'); 
00021             break; 
00022         } 
00023         changed = 0; 
00024         phase1_down (); 
00025         cross = graph_crossings (); 
00026         alt = 0; 
00027         if ((cross < nr_crossings) || (nr_bary_iterations < min_baryiterations))  
00028         { 
00029             changed = 1; 
00030             copy_layers (layer, tmp_layer); 
00031             nr_crossings = cross; 
00032             alt_startlevel = tmp_startlevel;        
00033         } 
00034         else if (have_alternative)  
00035         { 
00036             copy_layers (tmp_layer, layer); 
00037             phase1_down (); 
00038             cross = graph_crossings (); 
00039             if (cross < nr_crossings)  
00040             { 
00041                 changed = 1; 
00042                 copy_layers (layer, tmp_layer); 
00043                 nr_crossings = cross; 
00044                 alt_startlevel = tmp_startlevel; 
00045             } 
00046             else if (cross > nr_crossings)  
00047             { 
00048                 copy_layers (tmp_layer, layer); 
00049                 tmp_startlevel = alt_startlevel; 
00050             } 
00051             else 
00052                 alt = 1; 
00053         } else if (cross == nr_crossings) 
00054             alt = 1; 
00055         else  
00056         {          
00057             copy_layers (tmp_layer, layer); 
00058             tmp_startlevel = alt_startlevel; 
00059         } 
00060         have_alternative = alt; 
00061         phase1_up (); 
00062         cross = graph_crossings (); 
00063         alt = 0; 
00064         if ((cross < nr_crossings) || (nr_bary_iterations < min_baryiterations))  
00065         {          
00066             changed = 1;     
00067             copy_layers (layer, tmp_layer); 
00068             nr_crossings = cross; 
00069             alt_startlevel = tmp_startlevel; 
00070         } 
00071         else if (have_alternative)  
00072         { 
00073             copy_layers (tmp_layer, layer); 
00074             phase1_up (); 
00075             cross = graph_crossings (); 
00076             if (cross < nr_crossings)  
00077             { 
00078                 changed = 1;                
00079                 copy_layers (layer, tmp_layer); 
00080                 nr_crossings = cross; 
00081                 alt_startlevel = tmp_startlevel; 
00082             } 
00083             else if (cross > nr_crossings)  
00084             { 
00085                 copy_layers (tmp_layer, layer); 
00086                 tmp_startlevel = alt_startlevel;                
00087             } 
00088             else 
00089                 alt = 1; 
00090         } else if (cross == nr_crossings) 
00091             alt = 1; 
00092         else  
00093         {           
00094             copy_layers (tmp_layer, layer); 
00095             tmp_startlevel = alt_startlevel; 
00096         } 
00097         have_alternative = alt; 
00098 
00099         if (nr_crossings == 0) 
00100             return; 
00101  
00102     } 
00103     if (nr_crossings == 0) 
00104         return; 
00105  
00106     if (skip_baryphase2) 
00107         return; 
00108  
00109     phase1_allowed = 0; 
00110     tmp_startlevel = alt_startlevel = 0; 
00111     changed = 1; 
00112     while (changed)  
00113     { 
00114         nr_bary_iterations++; 
00115         if (nr_bary_iterations >= max_baryiterations)  
00116         { 
00117             gs_wait_message ('t'); 
00118             break; 
00119         } 
00120         if (G_timelimit > 0) if (test_timelimit (60))  
00121         { 
00122             gs_wait_message ('t'); 
00123             break; 
00124         } 
00125         changed = 0; 
00126         phase2_startlevel = tmp_startlevel; 
00127         phase2_down (); 
00128         tmp_startlevel = phase2_startlevel; 
00129         
00130         if (tmp_startlevel > maxdepth) tmp_startlevel = 0; 
00131         cross = graph_crossings (); 
00132         alt = 0; 
00133         
00134         if (cross < nr_crossings)  
00135         { 
00136             changed = 1; 
00137             copy_layers (layer, tmp_layer); 
00138             nr_crossings = cross; 
00139             alt_startlevel = tmp_startlevel; 
00140         } 
00141         else if (have_alternative)  
00142         { 
00143             copy_layers (tmp_layer, layer); 
00144             phase2_startlevel = tmp_startlevel = alt_startlevel; 
00145             phase2_down (); 
00146             tmp_startlevel = phase2_startlevel; 
00147             if (tmp_startlevel > maxdepth) tmp_startlevel = 0; 
00148             cross = graph_crossings (); 
00149             if (cross < nr_crossings)  
00150             { 
00151                 changed = 1; 
00152                 copy_layers (layer, tmp_layer); 
00153                 nr_crossings = cross; 
00154                 alt_startlevel = tmp_startlevel; 
00155             } 
00156             else if (cross > nr_crossings)  
00157             { 
00158                 copy_layers (tmp_layer, layer); 
00159                 tmp_startlevel = alt_startlevel; 
00160             } 
00161             else alt = 1; 
00162         } else if (cross == nr_crossings) alt = 1; 
00163         else  
00164         {          
00165             copy_layers (tmp_layer, layer);         
00166             tmp_startlevel = alt_startlevel; 
00167         } 
00168         have_alternative = alt; 
00169         
00170         if (nr_crossings == 0) 
00171             return;     
00172     } 
00173 
00174     tmp_startlevel = alt_startlevel = maxdepth + 1; 
00175     changed = 1; 
00176     while (changed)  
00177     { 
00178         nr_bary_iterations++; 
00179         if (nr_bary_iterations >= max_baryiterations)  
00180         { 
00181             gs_wait_message ('t'); 
00182             break; 
00183         } if (G_timelimit > 0) if (test_timelimit (60))  
00184         { 
00185             gs_wait_message ('t'); 
00186             break; 
00187         } changed = 0; 
00188         phase2_startlevel = tmp_startlevel; 
00189         phase2_up (); 
00190         tmp_startlevel = phase2_startlevel; 
00191         if (tmp_startlevel < 0) tmp_startlevel = maxdepth; 
00192         cross = graph_crossings (); 
00193         alt = 0; 
00194         if (cross < nr_crossings)  
00195         { 
00196             changed = 1; 
00197             copy_layers (layer, tmp_layer); 
00198             nr_crossings = cross; 
00199             alt_startlevel = tmp_startlevel; 
00200         } else if (have_alternative)    { 
00201 
00202             copy_layers (tmp_layer, layer); 
00203             phase2_startlevel = tmp_startlevel = alt_startlevel; 
00204             phase2_up (); 
00205             tmp_startlevel = phase2_startlevel; 
00206             if (tmp_startlevel < 0) tmp_startlevel = maxdepth; 
00207             cross = graph_crossings (); 
00208             if (cross < nr_crossings)  
00209             { 
00210                 changed = 1; 
00211                 copy_layers (layer, tmp_layer); 
00212                 nr_crossings = cross; 
00213                 alt_startlevel = tmp_startlevel; 
00214             } 
00215             else if (cross > nr_crossings)  
00216             { 
00217                 copy_layers (tmp_layer, layer); 
00218                 tmp_startlevel = alt_startlevel; 
00219             } 
00220             else 
00221                 alt = 1; 
00222         } else if (cross == nr_crossings) alt = 1; 
00223         else  
00224         { 
00225             copy_layers (tmp_layer, layer); 
00226             tmp_startlevel = alt_startlevel; 
00227         } 
00228         have_alternative = alt; 
00229         if (nr_crossings == 0) 
00230             return; 
00231     }
00232 }

Generated on Sat Aug 6 11:49:18 2005 for VCGIntrospector by doxygen 1.3.6