48 double relative_tol,
double *given_coords,
49 int **orderingp,
int **levelsp,
int *num_levelsp)
56 double hierarchy_span;
64 if (compute_y_coords(
graph, n, y, n)) {
71 *orderingp = ordering =
gv_calloc(n,
sizeof(
int));
72 for (i = 0; i < n; i++) {
81 hierarchy_span = y[ordering[n - 1]] - y[ordering[0]];
82 tol =
MAX(abs_tol, relative_tol * hierarchy_span / (n - 1));
89 for (i = 1; i < n; i++) {
90 if (y[ordering[i]] - y[ordering[i - 1]] >
tol) {
94 *num_levelsp = num_levels;
95 if (num_levels == 0) {
96 *levelsp = levels =
gv_calloc(1,
sizeof(
int));
100 *levelsp = levels =
gv_calloc(num_levels,
sizeof(
int));
101 for (i = 1; i < n; i++) {
102 if (y[ordering[i]] - y[ordering[i - 1]] >
tol) {
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
Agraph_t * graph(char *name)
void quicksort_place(double *place, int *ordering, int size)