Go to the source code of this file.
Classes | |
struct | adjedge |
struct | gedge |
struct | gnode |
struct | gnlist |
struct | depth_entry |
struct | dllist |
Typedefs | |
typedef adjedge * | ADJEDGE |
typedef gedge * | GEDGE |
typedef gnode * | GNODE |
typedef gnlist * | GNLIST |
typedef depth_entry | DEPTH |
typedef dllist * | DLLIST |
Enumerations | |
enum | values_crossing_heuristics { CROSSING_BARY = 0, CROSSING_MEDIAN, CROSSING_BARYMEDIAN, CROSSING_MEDIANBARY } |
Functions | |
void | __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function) __attribute__((__nothrow__)) __attribute__((__noreturn__)) |
void | __assert_perror_fail (int __errnum, __const char *__file, unsigned int __line, __const char *__function) __attribute__((__nothrow__)) __attribute__((__noreturn__)) |
void | __assert (const char *__assertion, const char *__file, int __line) __attribute__((__nothrow__)) __attribute__((__noreturn__)) |
int | compare_pos (const GNODE *a, const GNODE *b) |
int | compare_bary (const GNODE *a, const GNODE *b) |
void | save_level (int i) |
void | checkcrossing (int j) |
float | predbary (GNODE node) |
float | succbary (GNODE node) |
float | predmedian (GNODE node) |
float | succmedian (GNODE node) |
void | phase2_down () |
void | phase2_up () |
int | resort_down_layer (int i) |
int | resort_up_layer (int i) |
Variables | |
int | max_nodes_per_layer |
DATA. | |
DEPTH * | layer |
int | nr_crossings |
GNODE * | save_array |
int | crossing_heuristics |
GNODE * | sort_array |
int | size_of_sortarray |
DEPTH * | tmp_layer |
int | size_of_tlayer |
int | maxdepth |
int | size_upper_list |
int | size_lower_list |
DLLIST | lower_list |
DLLIST | lower_list_end |
DLLIST | upper_list |
DLLIST | upper_list_end |
int | nr_tcrossings |
int | max_baryiterations |
int | min_baryiterations |
int | nr_bary_iterations |
int | max_eprio |
int | max_horder_num |
int | phase2_startlevel = 0 |
int | skip_baryphase2 |
int | G_timelimit |
int | maxr_lower_list |
int | maxr_upper_list |
int | maxr_sum |
int | upperxpos |
int | lowerxpos |
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 277 of file clean2.c.
00278 { 00279 00280 CROSSING_BARY = 0, 00281 CROSSING_MEDIAN, 00282 CROSSING_BARYMEDIAN, 00283 CROSSING_MEDIANBARY 00284 } |
|
|
|
Referenced by checkcrossing(). |
|
|
|
Definition at line 433 of file clean2.c. References __assert_fail(), calc_all_layers_crossings(), graph_crossings(), and nr_crossings. Referenced by phase2_down(), and phase2_up().
00434 { 00435 00436 calc_all_layers_crossings (); 00437 00438 ((void) 00439 (__builtin_expect (!!((j == graph_crossings ())), 1) ? 0 00440 : (__assert_fail 00441 ("(j==graph_crossings())", "clean.c", 17, __PRETTY_FUNCTION__), 0))); 00442 00443 printf ("Phase2_down: nr_crossings old: %d new: %d\n", nr_crossings, j); 00444 00445 } |
|
Definition at line 7 of file bary_functions.c. References GNODE.
00008 { 00009 if ((((*a)->bary) == 0.0) || (((*b)->bary) == 0.0)) return (0); 00010 if (((*a)->bary) > ((*b)->bary)) return (1); 00011 if (((*a)->bary) < ((*b)->bary)) return (-1); 00012 return (0); 00013 } |
|
Definition at line 12 of file clean.c. Referenced by predmedian(), and succmedian().
00012 { if (((*a)->position) > ((*b)->position)) return (1); if (((*a)->position) < ((*b)->position)) return (-1); return (0);} |
|
Definition at line 578 of file clean2.c. References apply_horder(), array_to_level(), checkcrossing(), compare_bary(), CROSSING_BARY, CROSSING_BARYMEDIAN, crossing_heuristics, CROSSING_MEDIAN, CROSSING_MEDIANBARY, cycle_sort_array(), G_timelimit, GNODE, graph_crossings(), gs_wait_message(), layer, layer_crossing(), level_to_array(), maxdepth, nr_crossings, phase2_startlevel, predbary(), predmedian(), resort_up_down_layer(), sort_array, succbary(), succmedian(), test_timelimit(), and tmp_layer. Referenced by barycentering().
00579 { 00580 int i, j; 00581 int cross; 00582 gs_wait_message ('B'); 00583 if (phase2_startlevel <= maxdepth) 00584 for (i = phase2_startlevel; i <= maxdepth; i++) 00585 { 00586 if (G_timelimit > 0) 00587 if (test_timelimit (60)) 00588 { 00589 gs_wait_message ('t'); 00590 } 00591 level_to_array (i, 'u'); 00592 ; 00593 switch (crossing_heuristics) 00594 { 00595 case CROSSING_BARY: 00596 for (j = 0; j < ((layer[i]).anz); j++) 00597 ((sort_array[j])->bary) = (succbary (sort_array[j])); 00598 break; 00599 case CROSSING_MEDIAN: 00600 for (j = 0; j < ((layer[i]).anz); j++) 00601 ((sort_array[j])->bary) = (succmedian (sort_array[j])); 00602 break; 00603 case CROSSING_BARYMEDIAN: 00604 for (j = 0; j < ((layer[i]).anz); j++) 00605 ((sort_array[j])->bary) = 00606 (succbary (sort_array[j]) + 00607 succmedian (sort_array[j]) / 10000.0); 00608 break; 00609 case CROSSING_MEDIANBARY: 00610 for (j = 0; j < ((layer[i]).anz); j++) 00611 ((sort_array[j])->bary) = 00612 (succmedian (sort_array[j]) + 00613 succbary (sort_array[j]) / 10000.0); 00614 break; 00615 } 00616 if (((layer[i]).anz)) 00617 qsort (sort_array, ((layer[i]).anz), sizeof (GNODE), 00618 (int (*)(const void *, const void *)) compare_bary); 00619 if (cycle_sort_array (((layer[i]).anz))) 00620 { 00621 array_to_level (i); 00622 if (((layer[i]).resort_necessary)) 00623 apply_horder (i); 00624 if (i > 0) 00625 ((tmp_layer[i - 1]).cross) = layer_crossing (i - 1); 00626 if (i <= maxdepth) 00627 ((tmp_layer[i]).cross) = layer_crossing (i); 00628 resort_up_down_layer (i); 00629 cross = graph_crossings (); 00630 if (cross < nr_crossings) 00631 { 00632 phase2_startlevel = i + 1; 00633 checkcrossing (cross); 00634 return; 00635 } 00636 } 00637 } 00638 for (i = 0; (i < phase2_startlevel) && (i <= maxdepth); i++) 00639 { 00640 if (G_timelimit > 0) 00641 if (test_timelimit (60)) 00642 { 00643 gs_wait_message ('t'); 00644 } 00645 level_to_array (i, 'u'); 00646 ; 00647 switch (crossing_heuristics) 00648 { 00649 case CROSSING_BARY: 00650 for (j = 0; j < ((layer[i]).anz); j++) 00651 ((sort_array[j])->bary) = (predbary (sort_array[j])); 00652 break; 00653 case CROSSING_MEDIAN: 00654 for (j = 0; j < ((layer[i]).anz); j++) 00655 ((sort_array[j])->bary) = (predmedian (sort_array[j])); 00656 break; 00657 case CROSSING_BARYMEDIAN: 00658 for (j = 0; j < ((layer[i]).anz); j++) 00659 ((sort_array[j])->bary) = 00660 (predbary (sort_array[j]) + 00661 predmedian (sort_array[j]) / 10000.0); 00662 break; 00663 case CROSSING_MEDIANBARY: 00664 for (j = 0; j < ((layer[i]).anz); j++) 00665 ((sort_array[j])->bary) = 00666 (predmedian (sort_array[j]) + 00667 predbary (sort_array[j]) / 10000.0); 00668 break; 00669 } 00670 if (((layer[i]).anz)) 00671 qsort (sort_array, ((layer[i]).anz), sizeof (GNODE), 00672 (int (*)(const void *, const void *)) compare_bary); 00673 if (cycle_sort_array (((layer[i]).anz))) 00674 { 00675 array_to_level (i); 00676 if (((layer[i]).resort_necessary)) 00677 apply_horder (i); 00678 if (i > 0) 00679 ((tmp_layer[i - 1]).cross) = layer_crossing (i - 1); 00680 if (i <= maxdepth) 00681 ((tmp_layer[i]).cross) = layer_crossing (i); 00682 resort_up_down_layer (i); 00683 cross = graph_crossings (); 00684 if (cross < nr_crossings) 00685 { 00686 phase2_startlevel = i + 1; 00687 checkcrossing (cross); 00688 return; 00689 } 00690 } 00691 } 00692 } |
|
Definition at line 695 of file clean2.c. References apply_horder(), array_to_level(), checkcrossing(), compare_bary(), CROSSING_BARY, CROSSING_BARYMEDIAN, crossing_heuristics, CROSSING_MEDIAN, CROSSING_MEDIANBARY, cycle_sort_array(), G_timelimit, GNODE, graph_crossings(), gs_wait_message(), layer, layer_crossing(), level_to_array(), maxdepth, nr_crossings, phase2_startlevel, resort_down_up_layer(), sort_array, succbary(), succmedian(), test_timelimit(), and tmp_layer. Referenced by barycentering().
00696 { 00697 int i, j; 00698 int cross; 00699 gs_wait_message ('B'); 00700 if (phase2_startlevel <= maxdepth) 00701 for (i = phase2_startlevel; i <= maxdepth; i++) 00702 { 00703 if (G_timelimit > 0) 00704 if (test_timelimit (60)) 00705 { 00706 gs_wait_message ('t'); 00707 } 00708 level_to_array (i, 'u'); 00709 ; 00710 switch (crossing_heuristics) 00711 { 00712 case CROSSING_BARY: 00713 for (j = 0; j < ((layer[i]).anz); j++) 00714 ((sort_array[j])->bary) = (succbary (sort_array[j])); 00715 break; 00716 case CROSSING_MEDIAN: 00717 for (j = 0; j < ((layer[i]).anz); j++) 00718 ((sort_array[j])->bary) = (succmedian (sort_array[j])); 00719 break; 00720 case CROSSING_BARYMEDIAN: 00721 for (j = 0; j < ((layer[i]).anz); j++) 00722 ((sort_array[j])->bary) = 00723 (succbary (sort_array[j]) + 00724 succmedian (sort_array[j]) / 10000.0); 00725 break; 00726 case CROSSING_MEDIANBARY: 00727 for (j = 0; j < ((layer[i]).anz); j++) 00728 ((sort_array[j])->bary) = 00729 (succmedian (sort_array[j]) + 00730 succbary (sort_array[j]) / 10000.0); 00731 break; 00732 } 00733 if (((layer[i]).anz)) 00734 qsort (sort_array, ((layer[i]).anz), sizeof (GNODE), 00735 (int (*)(const void *, const void *)) compare_bary); 00736 if (cycle_sort_array (((layer[i]).anz))) 00737 { 00738 array_to_level (i); 00739 if (((layer[i]).resort_necessary)) 00740 apply_horder (i); 00741 if (i > 0) 00742 ((tmp_layer[i - 1]).cross) = layer_crossing (i - 1); 00743 if (i <= maxdepth) 00744 ((tmp_layer[i]).cross) = layer_crossing (i); 00745 resort_down_up_layer (i); 00746 cross = graph_crossings (); 00747 if (cross < nr_crossings) 00748 { 00749 phase2_startlevel = i + 1; 00750 checkcrossing (cross); 00751 return; 00752 } 00753 } 00754 } 00755 for (i = 0; (i < phase2_startlevel) && (i <= maxdepth); i++) 00756 { 00757 if (G_timelimit > 0) 00758 if (test_timelimit (60)) 00759 { 00760 gs_wait_message ('t'); 00761 } 00762 level_to_array (i, 'u'); 00763 ; 00764 switch (crossing_heuristics) 00765 { 00766 case CROSSING_BARY: 00767 for (j = 0; j < ((layer[i]).anz); j++) 00768 ((sort_array[j])->bary) = (succbary (sort_array[j])); 00769 break; 00770 case CROSSING_MEDIAN: 00771 for (j = 0; j < ((layer[i]).anz); j++) 00772 ((sort_array[j])->bary) = (succmedian (sort_array[j])); 00773 break; 00774 case CROSSING_BARYMEDIAN: 00775 for (j = 0; j < ((layer[i]).anz); j++) 00776 ((sort_array[j])->bary) = 00777 (succbary (sort_array[j]) + 00778 succmedian (sort_array[j]) / 10000.0); 00779 break; 00780 case CROSSING_MEDIANBARY: 00781 for (j = 0; j < ((layer[i]).anz); j++) 00782 ((sort_array[j])->bary) = 00783 (succmedian (sort_array[j]) + 00784 succbary (sort_array[j]) / 10000.0); 00785 break; 00786 } 00787 if (((layer[i]).anz)) 00788 qsort (sort_array, ((layer[i]).anz), sizeof (GNODE), 00789 (int (*)(const void *, const void *)) compare_bary); 00790 if (cycle_sort_array (((layer[i]).anz))) 00791 { 00792 array_to_level (i); 00793 if (((layer[i]).resort_necessary)) 00794 apply_horder (i); 00795 if (i > 0) 00796 ((tmp_layer[i - 1]).cross) = layer_crossing (i - 1); 00797 if (i <= maxdepth) 00798 ((tmp_layer[i]).cross) = layer_crossing (i); 00799 resort_down_up_layer (i); 00800 cross = graph_crossings (); 00801 if (cross < nr_crossings) 00802 { 00803 phase2_startlevel = i + 1; 00804 checkcrossing (cross); 00805 return; 00806 } 00807 } 00808 } 00809 } |
|
Definition at line 448 of file clean2.c. References ADJEDGE, gedge::anchor, GNODE, gnode::indegree, adjedge::kante, adjedge::next, gnode::pred, and gedge::start. Referenced by phase2_down(), phase2_up(), resort_down_layer(), and tree_horizontal_order().
00449 { 00450 int Sum; 00451 ADJEDGE w; 00452 if ((node->indegree) == 0) 00453 return (0.0); 00454 Sum = 0; 00455 w = (node->pred); 00456 while (w) 00457 { 00458 Sum += (256.0 * ((w->kante->start)->position)); 00459 Sum += (w->kante->anchor); 00460 w = w->next; 00461 } 00462 return (((float) Sum) / ((float) (256.0 * (node->indegree)))); 00463 } |
|
Definition at line 484 of file clean2.c. References ADJEDGE, gedge::anchor, compare_pos(), GNODE, gnode::indegree, adjedge::kante, adjedge::next, gnode::position, gnode::pred, save_array, and gedge::start. Referenced by phase2_down(), phase2_up(), and resort_down_layer().
00485 { 00486 int i, leftpart, rightpart; 00487 ADJEDGE w; 00488 ; 00489 ; 00490 switch (((node->indegree))) 00491 { 00492 case 0: 00493 return (0.0); 00494 break; 00495 case 1: 00496 return (((float) (node->pred->kante->start->position)) + 00497 ((float) (node->pred->kante->anchor)) / 256.0); 00498 break; 00499 case 2: 00500 break; 00501 return (((float) (node->pred->kante->start->position) + 00502 (node->pred->next->kante->start->position)) / 2.0); 00503 } 00504 i = 0; 00505 w = ((node)->pred); 00506 while (w) 00507 { 00508 save_array[i++] = (((((w)->kante))->start)); 00509 w = ((w)->next); 00510 } 00511 if (i) 00512 qsort (save_array, i, sizeof (GNODE), 00513 (int (*)(const void *, const void *)) compare_pos); 00514 if (i % 2) 00515 return ((float) ((save_array[i / 2])->position)); 00516 leftpart = 00517 ((save_array[i / 2 - 1])->position) - ((save_array[0])->position); 00518 rightpart = 00519 ((save_array[i - 1])->position) - ((save_array[i / 2])->position); 00520 return (((float) 00521 (((save_array[i / 2 - 1])->position) * rightpart + 00522 ((save_array[i / 2])->position) * leftpart)) / 00523 ((float) (leftpart + rightpart))); 00524 } |
|
Definition at line 814 of file clean2.c. References apply_horder(), array_to_level(), compare_bary(), CROSSING_BARY, CROSSING_BARYMEDIAN, crossing_heuristics, CROSSING_MEDIAN, CROSSING_MEDIANBARY, GNODE, layer, layer_crossing(), level_to_array(), predbary(), predmedian(), restore_level(), save_level(), sort_array, and tmp_layer.
00815 { 00816 int c; 00817 int j; 00818 level_to_array (i + 1, 'd'); 00819 switch (crossing_heuristics) 00820 { 00821 case CROSSING_BARY: 00822 for (j = 0; j < ((layer[i]).anz); j++) 00823 ((sort_array[j])->bary) = (predbary (sort_array[j])); 00824 break; 00825 case CROSSING_MEDIAN: 00826 for (j = 0; j < ((layer[i]).anz); j++) 00827 ((sort_array[j])->bary) = (predmedian (sort_array[j])); 00828 break; 00829 case CROSSING_BARYMEDIAN: 00830 for (j = 0; j < ((layer[i]).anz); j++) 00831 ((sort_array[j])->bary) = 00832 (predbary (sort_array[j]) + predmedian (sort_array[j]) / 10000.0); 00833 break; 00834 case CROSSING_MEDIANBARY: 00835 for (j = 0; j < ((layer[i]).anz); j++) 00836 ((sort_array[j])->bary) = 00837 (predmedian (sort_array[j]) + predbary (sort_array[j]) / 10000.0); 00838 break; 00839 } 00840 if (((layer[i]).anz)) 00841 qsort (sort_array, ((layer[i]).anz), sizeof (GNODE), 00842 (int (*)(const void *, const void *)) compare_bary); 00843 save_level (i + 1); 00844 array_to_level (i + 1); 00845 if (((layer[i + 1]).resort_necessary)) 00846 apply_horder (i + 1); 00847 c = layer_crossing (i); 00848 if (c <= ((tmp_layer[i]).cross)) 00849 { 00850 ((tmp_layer[i]).cross) = c; 00851 if (i > 0) 00852 ((tmp_layer[i + 1]).cross) = layer_crossing (i + 1); 00853 return (1); 00854 } 00855 restore_level (i + 1); 00856 return (0); 00857 } |
|
Definition at line 860 of file clean2.c. References apply_horder(), array_to_level(), compare_bary(), CROSSING_BARY, CROSSING_BARYMEDIAN, crossing_heuristics, CROSSING_MEDIAN, CROSSING_MEDIANBARY, GNODE, layer, layer_crossing(), level_to_array(), restore_level(), save_level(), sort_array, succbary(), succmedian(), and tmp_layer.
00861 { 00862 int c; 00863 int j; 00864 level_to_array (i, 'u'); 00865 switch (crossing_heuristics) 00866 { 00867 case CROSSING_BARY: 00868 for (j = 0; j < ((layer[i]).anz); j++) 00869 ((sort_array[j])->bary) = (succbary (sort_array[j])); 00870 break; 00871 case CROSSING_MEDIAN: 00872 for (j = 0; j < ((layer[i]).anz); j++) 00873 ((sort_array[j])->bary) = (succmedian (sort_array[j])); 00874 break; 00875 case CROSSING_BARYMEDIAN: 00876 for (j = 0; j < ((layer[i]).anz); j++) 00877 ((sort_array[j])->bary) = 00878 (succbary (sort_array[j]) + succmedian (sort_array[j]) / 10000.0); 00879 break; 00880 case CROSSING_MEDIANBARY: 00881 for (j = 0; j < ((layer[i]).anz); j++) 00882 ((sort_array[j])->bary) = 00883 (succmedian (sort_array[j]) + succbary (sort_array[j]) / 10000.0); 00884 break; 00885 } 00886 if (((layer[i]).anz)) 00887 qsort (sort_array, ((layer[i]).anz), sizeof (GNODE), 00888 (int (*)(const void *, const void *)) compare_bary); 00889 save_level (i); 00890 array_to_level (i); 00891 if (((layer[i]).resort_necessary)) 00892 apply_horder (i); 00893 c = layer_crossing (i); 00894 if (c <= ((tmp_layer[i]).cross)) 00895 { 00896 ((tmp_layer[i]).cross) = c; 00897 if (i > 0) 00898 ((tmp_layer[i - 1]).cross) = layer_crossing (i - 1); 00899 return (1); 00900 } 00901 restore_level (i); 00902 return (0); 00903 } |
|
Definition at line 358 of file bary_functions.c. References GNLIST, save_array, STATIC, and tmp_layer. Referenced by resort_down_layer(), and resort_up_layer().
00358 { 00359 int j; GNLIST hn; ; j = 0; 00360 hn = ((tmp_layer[i]).succlist); 00361 while (hn) { 00362 save_array[j++] = ((hn)->node); 00363 hn = ((hn)->next); 00364 } 00365 } |
|
Definition at line 466 of file clean2.c. References ADJEDGE, gedge::anchor, gedge::end, GNODE, adjedge::kante, adjedge::next, gnode::outdegree, and gnode::succ. Referenced by phase2_down(), phase2_up(), and resort_up_layer().
00467 { 00468 int Sum; 00469 ADJEDGE w; 00470 if ((node->outdegree) == 0) 00471 return (0.0); 00472 Sum = 0; 00473 w = (node->succ); 00474 while (w) 00475 { 00476 Sum += (256.0 * ((w->kante->end)->position)); 00477 Sum += (w->kante->anchor); 00478 w = w->next; 00479 } 00480 return (((float) Sum) / ((float) (256.0 * (node->outdegree)))); 00481 } |
|
Definition at line 527 of file clean2.c. References ADJEDGE, gedge::anchor, compare_pos(), gedge::end, GNODE, adjedge::kante, adjedge::next, gnode::outdegree, gnode::position, save_array, and gnode::succ. Referenced by phase2_down(), phase2_up(), and resort_up_layer().
00528 { 00529 int i, leftpart, rightpart; 00530 ADJEDGE w; 00531 ; 00532 ; 00533 switch (((node->outdegree))) 00534 { 00535 case 0: 00536 return (0.0); 00537 break; 00538 case 1: 00539 return (((float) (node->succ->kante->end->position)) - 00540 ((float) (node->succ->kante->anchor)) / 256.0); 00541 break; 00542 case 2: 00543 break; 00544 return (((float) (node->succ->kante->end->position) + 00545 (node->succ->next->kante->end->position)) / 2.0); 00546 } 00547 i = 0; 00548 w = ((node)->succ); 00549 while (w) 00550 { 00551 save_array[i++] = (((((w)->kante))->end)); 00552 w = ((w)->next); 00553 } 00554 if (i) 00555 qsort (save_array, i, sizeof (GNODE), 00556 (int (*)(const void *, const void *)) compare_pos); 00557 if (i % 2) 00558 return ((float) ((save_array[i / 2])->position)); 00559 leftpart = 00560 ((save_array[i / 2 - 1])->position) - ((save_array[0])->position); 00561 rightpart = 00562 ((save_array[i - 1])->position) - ((save_array[i / 2])->position); 00563 return (((float) 00564 (((save_array[i / 2 - 1])->position) * rightpart + 00565 ((save_array[i / 2])->position) * leftpart)) / 00566 ((float) (leftpart + rightpart))); 00567 } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DATA.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|