18 static int *given_levels =
NULL;
51 double relative_tol,
double *given_coords,
52 int **orderingp,
int **levelsp,
int *num_levelsp)
57 int use_given_levels =
FALSE;
61 double hierarchy_span;
69 if (compute_y_coords(graph, n, y, n)) {
76 *orderingp = ordering =
N_NEW(n,
int);
77 for (i = 0; i < n; i++) {
82 spread = y[ordering[n - 1]] - y[ordering[0]];
86 use_given_levels =
TRUE;
87 for (i = 0; i < n; i++) {
88 use_given_levels = use_given_levels && given_levels[i] >= 0;
91 if (use_given_levels) {
92 for (i = 0; i < n; i++) {
93 y[i] = given_levels[i];
103 hierarchy_span = y[ordering[n - 1]] - y[ordering[0]];
104 tol =
MAX(abs_tol, relative_tol * hierarchy_span / (n - 1));
111 for (i = 1; i < n; i++) {
112 if (y[ordering[i]] - y[ordering[i - 1]] > tol) {
116 *num_levelsp = num_levels;
117 if (num_levels == 0) {
118 *levelsp = levels =
N_GNEW(1,
int);
122 *levelsp = levels =
N_GNEW(num_levels,
int);
123 for (i = 1; i < n; i++) {
124 if (y[ordering[i]] - y[ordering[i - 1]] > tol) {
void quicksort_place(double *place, int *ordering, int first, int last)
Agraph_t * graph(char *name)