Graphviz 13.0.0~dev.20250121.0651
Loading...
Searching...
No Matches
overlap.c
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#include "config.h"
12#include <neatogen/overlap.h>
13#include <stdatomic.h>
14#include <util/alloc.h>
15
16#if ((defined(HAVE_GTS) || defined(HAVE_TRIANGLE)) && defined(SFDP))
17
18#include <sparse/SparseMatrix.h>
19#include <neatogen/call_tri.h>
21#include <common/types.h>
22#include <math.h>
23#include <common/globals.h>
24#include <stdbool.h>
25#include <time.h>
26
27static void ideal_distance_avoid_overlap(int dim, SparseMatrix A, double *x, double *width, double *ideal_distance, double *tmax, double *tmin){
28 /* if (x1>x2 && y1 > y2) we want either x1 + t (x1-x2) - x2 > (width1+width2), or y1 + t (y1-y2) - y2 > (height1+height2),
29 hence t = MAX(expandmin, MIN(expandmax, (width1+width2)/(x1-x2) - 1, (height1+height2)/(y1-y2) - 1)), and
30 new ideal distance = (1+t) old_distance. t can be negative sometimes.
31 The result ideal distance is set to negative if the edge needs shrinking
32 */
33 int i, j, jj;
34 int *ia = A->ia, *ja = A->ja;
35 double dist, dx, dy, wx, wy, t;
36 double expandmax = 1.5, expandmin = 1;
37
38 *tmax = 0;
39 *tmin = 1.e10;
40 assert(SparseMatrix_is_symmetric(A, false));
41 for (i = 0; i < A->m; i++){
42 for (j = ia[i]; j < ia[i+1]; j++){
43 jj = ja[j];
44 if (jj == i) continue;
45 dist = distance(x, dim, i, jj);
46 dx = fabs(x[i*dim] - x[jj*dim]);
47 dy = fabs(x[i*dim+1] - x[jj*dim+1]);
48 wx = width[i*dim]+width[jj*dim];
49 wy = width[i*dim+1]+width[jj*dim+1];
50 if (dx < MACHINEACC*wx && dy < MACHINEACC*wy){
51 ideal_distance[j] = hypot(wx, wy);
52 *tmax = 2;
53 } else {
54 if (dx < MACHINEACC*wx){
55 t = wy/dy;
56 } else if (dy < MACHINEACC*wy){
57 t = wx/dx;
58 } else {
59 t = fmin(wx / dx, wy / dy);
60 }
61 if (t > 1) t = fmax(t, 1.001);/* no point in things like t = 1.00000001 as this slow down convergence */
62 *tmax = fmax(*tmax, t);
63 *tmin = fmin(*tmin, t);
64 t = fmin(expandmax, t);
65 t = fmax(expandmin, t);
66 if (t > 1) {
67 ideal_distance[j] = t*dist;
68 } else {
69 ideal_distance[j] = -t*dist;
70 }
71 }
72
73 }
74 }
75}
76
77enum {INTV_OPEN, INTV_CLOSE};
78
79typedef struct {
80 int node;
81 double x;
82 int status;
83} scan_point;
84
85static int comp_scan_points(const void *p, const void *q){
86 const scan_point *pp = p;
87 const scan_point *qq = q;
88 if (pp->x > qq->x){
89 return 1;
90 } else if (pp->x < qq->x){
91 return -1;
92 } else {
93 if (pp->node > qq->node){
94 return 1;
95 } else if (pp->node < qq->node){
96 return -1;
97 }
98 return 0;
99 }
100 return 0;
101}
102
103static void NodeDest(void* a) {
104 (void)a;
105 /* free((int*)a);*/
106}
107
108static SparseMatrix get_overlap_graph(int dim, int n, double *x, double *width, int check_overlap_only){
109 /* if check_overlap_only = TRUE, we only check whether there is one overlap */
110 int i, k, neighbor;
111 SparseMatrix A = NULL, B = NULL;
112 rb_red_blk_node *newNode, *newNode0;
113 rb_red_blk_tree* treey;
114 double one = 1;
115
117
118 scan_point *scanpointsx = gv_calloc(2 * n, sizeof(scan_point));
119 for (i = 0; i < n; i++){
120 scanpointsx[2*i].node = i;
121 scanpointsx[2*i].x = x[i*dim] - width[i*dim];
122 scanpointsx[2*i].status = INTV_OPEN;
123 scanpointsx[2*i+1].node = i+n;
124 scanpointsx[2*i+1].x = x[i*dim] + width[i*dim];
125 scanpointsx[2*i+1].status = INTV_CLOSE;
126 }
127 qsort(scanpointsx, 2*n, sizeof(scan_point), comp_scan_points);
128
129 scan_point *scanpointsy = gv_calloc(2 * n, sizeof(scan_point));
130 for (i = 0; i < n; i++){
131 scanpointsy[i].node = i;
132 scanpointsy[i].x = x[i*dim+1] - width[i*dim+1];
133 scanpointsy[i].status = INTV_OPEN;
134 scanpointsy[i+n].node = i;
135 scanpointsy[i+n].x = x[i*dim+1] + width[i*dim+1];
136 scanpointsy[i+n].status = INTV_CLOSE;
137 }
138
139 treey = RBTreeCreate(comp_scan_points, NodeDest);
140
141 for (i = 0; i < 2*n; i++){
142#ifdef DEBUG_RBTREE
143 fprintf(stderr," k = %d node = %d x====%f\n",(scanpointsx[i].node)%n, (scanpointsx[i].node), (scanpointsx[i].x));
144#endif
145
146 k = (scanpointsx[i].node)%n;
147
148
149 if (scanpointsx[i].status == INTV_OPEN){
150#ifdef DEBUG_RBTREE
151 fprintf(stderr, "inserting...");
152 treey->PrintKey(&(scanpointsy[k]));
153#endif
154
155 RBTreeInsert(treey, &scanpointsy[k]); // add both open and close int for y
156
157#ifdef DEBUG_RBTREE
158 fprintf(stderr, "inserting2...");
159 treey->PrintKey(&(scanpointsy[k+n]));
160#endif
161
162 RBTreeInsert(treey, &scanpointsy[k + n]);
163 } else {
164 double bsta, bbsta, bsto, bbsto; int ii;
165
166 assert(scanpointsx[i].node >= n);
167
168 newNode = newNode0 = RBExactQuery(treey, &(scanpointsy[k + n]));
169 ii = ((scan_point *)newNode->key)->node;
170 assert(ii < n);
171 bsta = scanpointsy[ii].x; bsto = scanpointsy[ii+n].x;
172
173#ifdef DEBUG_RBTREE
174 fprintf(stderr, "popping..%d....yinterval={%f,%f}\n", scanpointsy[k + n].node, bsta, bsto);
175 treey->PrintKey(newNode->key);
176#endif
177
178 assert(treey->nil != newNode);
179 while ((newNode) && ((newNode = TreePredecessor(treey, newNode)) != treey->nil)){
180 neighbor = (((scan_point *)newNode->key)->node)%n;
181 bbsta = scanpointsy[neighbor].x; bbsto = scanpointsy[neighbor+n].x;/* the y-interval of the node that has one end of the interval lower than the top of the leaving interval (bsto) */
182#ifdef DEBUG_RBTREE
183 fprintf(stderr," predecessor is node %d y = %f\n", ((scan_point *)newNode->key)->node, ((scan_point *)newNode->key)->x);
184#endif
185 if (neighbor != k){
186 if (fabs(0.5*(bsta+bsto) - 0.5*(bbsta+bbsto)) < 0.5*(bsto-bsta) + 0.5*(bbsto-bbsta)){/* if the distance of the centers of the interval is less than sum of width, we have overlap */
188#ifdef DEBUG_RBTREE
189 fprintf(stderr,"====================================== %d %d\n",k,neighbor);
190#endif
191 if (check_overlap_only) goto check_overlap_RETURN;
192 }
193 }
194 }
195
196#ifdef DEBUG_RBTREE
197 fprintf(stderr, "deleting...");
198 treey->PrintKey(newNode0->key);
199#endif
200
201 if (newNode0) RBDelete(treey,newNode0);
202 }
203 }
204
205check_overlap_RETURN:
206 free(scanpointsx);
207 free(scanpointsy);
208 RBTreeDestroy(treey);
209
212 A = SparseMatrix_symmetrize(B, false);
214 if (Verbose) fprintf(stderr, "found %d clashes\n", A->nz);
215 return A;
216}
217
218
219
220/* ============================== label overlap smoother ==================*/
221
222
223static void relative_position_constraints_delete(void *d){
224 if (!d) return;
226 free(data->irn);
227 free(data->jcn);
228 free(data->val);
229 /* other stuff inside relative_position_constraints is passed back to the user hence no need to deallocator*/
230 free(d);
231}
232
233static relative_position_constraints relative_position_constraints_new(SparseMatrix A_constr, int edge_labeling_scheme, int n_constr_nodes, int *constr_nodes){
234 assert(A_constr);
236 data->constr_penalty = 1;
237 data->edge_labeling_scheme = edge_labeling_scheme;
238 data->n_constr_nodes = n_constr_nodes;
239 data->constr_nodes = constr_nodes;
240 data->A_constr = A_constr;
241 data->irn = NULL;
242 data->jcn = NULL;
243 data->val = NULL;
244
245 return data;
246}
247static void scale_coord(int dim, int m, double *x, double scale){
248 int i;
249 for (i = 0; i < dim*m; i++) {
250 x[i] *= scale;
251 }
252}
253
254static double overlap_scaling(int dim, int m, double *x, double *width,
255 double scale_sta, double scale_sto,
256 double epsilon, int maxiter) {
257 /* do a bisection between scale_sta and scale_sto, up to maxiter iterations or till interval <= epsilon, to find the best scaling to avoid overlap
258 m: number of points
259 x: the coordinates
260 width: label size
261 scale_sta: starting bracket. If <= 0, assumed 0. If > 0, we will test this first and if no overlap, return.
262 scale_sto: stopping bracket. This must be overlap free if positive. If <= 0, we will find automatically by doubling from scale_sta, or epsilon if scale_sta <= 0.
263 typically usage:
264 - for shrinking down a layout to reduce white space, we will assume scale_sta and scale_sto are both given and positive, and scale_sta is the current guess.
265 - for scaling up, we assume scale_sta, scale_sto <= 0
266 */
267 double scale = -1, scale_best = -1;
269 int check_overlap_only = 1;
270 int overlap = 0;
271 double two = 2;
272 int iter = 0;
273
274 assert(epsilon > 0);
275
276 if (scale_sta <= 0) {
277 scale_sta = 0;
278 } else {
279 scale_coord(dim, m, x, scale_sta);
280 C = get_overlap_graph(dim, m, x, width, check_overlap_only);
281 if (!C || C->nz == 0) {
282 if (Verbose) fprintf(stderr," shrinking with %f works\n", scale_sta);
284 return scale_sta;
285 }
286 scale_coord(dim, m, x, 1./scale_sta);
288 }
289
290 if (scale_sto < 0){
291 if (scale_sta == 0) {
292 scale_sto = epsilon;
293 } else {
294 scale_sto = scale_sta;
295 }
296 scale_coord(dim, m, x, scale_sto);
297 do {
298 scale_sto *= two;
299 scale_coord(dim, m, x, two);
300 C = get_overlap_graph(dim, m, x, width, check_overlap_only);
301 overlap = (C && C->nz > 0);
303 } while (overlap);
304 scale_coord(dim, m, x, 1/scale_sto);/* unscale */
305 }
306
307 scale_best = scale_sto;
308 while (iter++ < maxiter && scale_sto - scale_sta > epsilon){
309
310 if (Verbose) fprintf(stderr,"in overlap_scaling iter=%d, maxiter=%d, scaling bracket: {%f,%f}\n", iter, maxiter, scale_sta, scale_sto);
311
312 scale = 0.5*(scale_sta + scale_sto);
313 scale_coord(dim, m, x, scale);
314 C = get_overlap_graph(dim, m, x, width, check_overlap_only);
315 scale_coord(dim, m, x, 1./scale);/* unscale */
316 overlap = (C && C->nz > 0);
318 if (overlap){
319 scale_sta = scale;
320 } else {
321 scale_best = scale_sto = scale;
322 }
323 }
324
325 /* final scaling */
326 scale_coord(dim, m, x, scale_best);
327 return scale_best;
328}
329
331 int dim, double *x, double *width, bool neighborhood_only,
332 double *max_overlap, double *min_overlap,
333 int edge_labeling_scheme, int n_constr_nodes, int *constr_nodes, SparseMatrix A_constr, int shrink
334 ){
335 int i, j, k, *iw, *jw, jdiag;
337 double *d, *w, diag_d, diag_w, dist;
338
339 assert((!A) || SparseMatrix_is_symmetric(A, false));
340
343 if (constr_nodes && n_constr_nodes > 0 && edge_labeling_scheme != ELSCHEME_NONE){
345 sm->data = relative_position_constraints_new(A_constr, edge_labeling_scheme, n_constr_nodes, constr_nodes);
346 sm->data_deallocator = relative_position_constraints_delete;
347 } else {
348 sm->data = NULL;
349 }
350
351 sm->tol_cg = 0.01;
352 sm->maxit_cg = floor(sqrt(A->m));
353
354 sm->lambda = gv_calloc(m, sizeof(double));
355
356 B= call_tri(m, x);
357
358 if (!neighborhood_only){
360 C = get_overlap_graph(dim, m, x, width, 0);
361 D = SparseMatrix_add(B, C);
364 B = D;
365 }
366 sm->Lw = B;
367 sm->Lwd = SparseMatrix_copy(sm->Lw);
368
369 if (!(sm->Lw) || !(sm->Lwd)) {
371 return NULL;
372 }
373
374 assert((sm->Lwd)->type == MATRIX_TYPE_REAL);
375
376 ideal_distance_avoid_overlap(dim, sm->Lwd, x, width, sm->Lwd->a, max_overlap, min_overlap);
377
378 /* no overlap at all! */
379 if (*max_overlap < 1 && shrink){
380 double scale_sta = fmin(1, *max_overlap * 1.0001);
381 const double scale_sto = 1;
382
383 if (Verbose) fprintf(stderr," no overlap (overlap = %f), rescale to shrink\n", *max_overlap - 1);
384
385 scale_sta = overlap_scaling(dim, m, x, width, scale_sta, scale_sto, 0.0001, 15);
386
387 *max_overlap = 1;
388 goto RETURN;
389 }
390
391 iw = sm->Lw->ia; jw = sm->Lw->ja;
392 w = sm->Lw->a;
393 d = sm->Lwd->a;
394
395 for (i = 0; i < m; i++){
396 diag_d = diag_w = 0;
397 jdiag = -1;
398 for (j = iw[i]; j < iw[i+1]; j++){
399 k = jw[j];
400 if (k == i){
401 jdiag = j;
402 continue;
403 }
404 if (d[j] > 0){/* those edges that needs expansion */
405 w[j] = -100/d[j]/d[j];
406 } else {/* those that needs shrinking is set to negative in ideal_distance_avoid_overlap */
407 w[j] = -1/d[j]/d[j];
408 d[j] = -d[j];
409 }
410 dist = d[j];
411 diag_w += w[j];
412 d[j] = w[j]*dist;
413 diag_d += d[j];
414
415 }
416
417 assert(jdiag >= 0);
418 w[jdiag] = -diag_w;
419 d[jdiag] = -diag_d;
420 }
421 RETURN:
422 return sm;
423}
424
426
428
429}
430
431double OverlapSmoother_smooth(OverlapSmoother sm, int dim, double *x){
432 int maxit_sm = 1;/* only using 1 iteration of stress majorization
433 is found to give better results and save time! */
434 return StressMajorizationSmoother_smooth(sm, dim, x, maxit_sm);
435}
436
437/*================================= end OverlapSmoother =============*/
438
439static void scale_to_edge_length(int dim, SparseMatrix A, double *x, double avg_label_size){
440 double dist;
441 int i;
442
443 if (!A) return;
445 if (Verbose) fprintf(stderr,"avg edge len=%f avg_label-size= %f\n", dist, avg_label_size);
446
447
448 dist = avg_label_size / fmax(dist, MACHINEACC);
449
450 for (i = 0; i < dim*A->m; i++) x[i] *= dist;
451}
452
453static void print_bounding_box(int n, int dim, double *x){
454 int i, k;
455
456 double *xmin = gv_calloc(dim, sizeof(double));
457 double *xmax = gv_calloc(dim, sizeof(double));
458
459 for (i = 0; i < dim; i++) xmin[i]=xmax[i] = x[i];
460
461 for (i = 0; i < n; i++){
462 for (k = 0; k < dim; k++){
463 xmin[k] = fmin(xmin[k], x[i * dim + k]);
464 xmax[k] = fmax(xmax[k], x[i * dim + k]);
465 }
466 }
467 fprintf(stderr,"bounding box = \n");
468 for (i = 0; i < dim; i++) fprintf(stderr,"{%f,%f}, ",xmin[i], xmax[i]);
469 fprintf(stderr,"\n");
470
471 free(xmin);
472 free(xmax);
473}
474
475static int check_convergence(double max_overlap, double res,
476 bool has_penalty_terms, double epsilon) {
477 if (!has_penalty_terms)
478 return (max_overlap <= 1);
479 return res < epsilon;
480}
481
482void remove_overlap(int dim, SparseMatrix A, double *x, double *label_sizes, int ntry, double initial_scaling,
483 int edge_labeling_scheme, int n_constr_nodes, int *constr_nodes, SparseMatrix A_constr, bool do_shrinking) {
484 /*
485 edge_labeling_scheme: if ELSCHEME_NONE, n_constr_nodes/constr_nodes/A_constr are not used
486
487 n_constr_nodes: number of nodes that has constraints, these are nodes that is
488 . constrained to be close to the average of its neighbors.
489 constr_nodes: a list of nodes that need to be constrained. If NULL, unused.
490 A_constr: neighbors of node i are in the row i of this matrix. i needs to sit
491 . in between these neighbors as much as possible. this must not be NULL
492 . if constr_nodes != NULL.
493
494 */
495
497 int i;
498 double LARGE = 100000;
499 double avg_label_size, res = LARGE;
500 double max_overlap = 0, min_overlap = 999;
501 bool neighborhood_only = true;
502 double epsilon = 0.005;
503 int shrink = 0;
504
505#ifdef TIME
506 clock_t cpu;
507#endif
508
509#ifdef TIME
510 cpu = clock();
511#endif
512
513 if (!label_sizes) return;
514
515 if (initial_scaling < 0) {
516 avg_label_size = 0;
517 for (i = 0; i < A->m; i++) avg_label_size += label_sizes[i*dim]+label_sizes[i*dim+1];
518 avg_label_size /= A->m;
519 scale_to_edge_length(dim, A, x, -initial_scaling*avg_label_size);
520 } else if (initial_scaling > 0){
521 scale_to_edge_length(dim, A, x, initial_scaling);
522 }
523
524 if (!ntry) return;
525
526#ifdef DEBUG
527 _statistics[0] = _statistics[1] = 0.;
528#endif
529
530 bool has_penalty_terms =
531 edge_labeling_scheme != ELSCHEME_NONE && n_constr_nodes > 0;
532 for (i = 0; i < ntry; i++){
533 if (Verbose) print_bounding_box(A->m, dim, x);
534 sm = OverlapSmoother_new(A, A->m, dim, x, label_sizes, neighborhood_only,
535 &max_overlap, &min_overlap, edge_labeling_scheme, n_constr_nodes, constr_nodes, A_constr, shrink);
536 if (Verbose) {
537 fprintf(stderr,
538 "overlap removal neighbors only?= %d iter -- %d, overlap factor = %g underlap factor = %g\n",
539 (int)neighborhood_only, i, max_overlap - 1, min_overlap);
540 }
541 if (check_convergence(max_overlap, res, has_penalty_terms, epsilon)) {
542
544 if (!neighborhood_only){
545 break;
546 } else {
547 res = LARGE;
548 neighborhood_only = false;
549 if (do_shrinking) {
550 shrink = 1;
551 }
552 continue;
553 }
554 }
555
556 res = OverlapSmoother_smooth(sm, dim, x);
557 if (Verbose) fprintf(stderr,"res = %f\n",res);
559 }
560 if (Verbose) {
561 fprintf(stderr,
562 "overlap removal neighbors only?= %d iter -- %d, overlap factor = %g underlap factor = %g\n",
563 (int)neighborhood_only, i, max_overlap - 1, min_overlap);
564 }
565
566 if (has_penalty_terms){
567 /* now do without penalty */
568 remove_overlap(dim, A, x, label_sizes, ntry, 0.,
569 ELSCHEME_NONE, 0, NULL, NULL, do_shrinking);
570 }
571
572#ifdef DEBUG
573 fprintf(stderr," number of cg iter = %f, number of stress majorization iter = %f number of overlap removal try = %d\n",
574 _statistics[0], _statistics[1], i - 1);
575#endif
576
577#ifdef TIME
578 fprintf(stderr, "post processing %f\n",((double) (clock() - cpu)) / CLOCKS_PER_SEC);
579#endif
580}
581
582#else
583#include <common/types.h>
584#include <sparse/SparseMatrix.h>
585void remove_overlap(int dim, SparseMatrix A, double *x, double *label_sizes, int ntry, double initial_scaling,
586 int edge_labeling_scheme, int n_constr_nodes, int *constr_nodes, SparseMatrix A_constr, bool do_shrinking)
587{
588 static atomic_flag once;
589
590 (void)dim;
591 (void)A;
592 (void)x;
593 (void)label_sizes;
594 (void)ntry;
595 (void)initial_scaling;
596 (void)edge_labeling_scheme;
597 (void)n_constr_nodes;
598 (void)constr_nodes;
599 (void)A_constr;
600 (void)do_shrinking;
601
602 if (!atomic_flag_test_and_set(&once)) {
603 agerrorf("remove_overlap: Graphviz not built with triangulation library\n");
604 }
605}
606#endif
SparseMatrix SparseMatrix_from_coordinate_format(SparseMatrix A)
SparseMatrix SparseMatrix_symmetrize(SparseMatrix A, bool pattern_symmetric_only)
SparseMatrix SparseMatrix_coordinate_form_add_entry(SparseMatrix A, int irn, int jcn, const void *val)
bool SparseMatrix_is_symmetric(SparseMatrix A, bool test_pattern_symmetry_only)
void SparseMatrix_delete(SparseMatrix A)
SparseMatrix SparseMatrix_copy(SparseMatrix A)
SparseMatrix SparseMatrix_add(SparseMatrix A, SparseMatrix B)
SparseMatrix SparseMatrix_new(int m, int n, int nz, int type, int format)
@ MATRIX_TYPE_REAL
@ FORMAT_COORD
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
Definition alloc.h:26
static void * gv_alloc(size_t size)
Definition alloc.h:47
SparseMatrix call_tri(int n, double *x)
Definition call_tri.c:19
static float dy
Definition draw.c:38
static float dx
Definition draw.c:37
#define A(n, t)
Definition expr.h:76
static double dist(int dim, double *x, double *y)
double distance(double *x, int dim, int i, int j)
Definition general.c:146
#define MACHINEACC
Definition general.h:76
double xmax
Definition geometry.c:15
double xmin
Definition geometry.c:15
static pointf scale(double c, pointf p)
Definition geomprocs.h:155
static bool Verbose
Definition gml2gv.c:23
void free(void *)
node NULL
Definition grammar.y:163
static node_list * newNode(Grid *g, Agnode_t *n, node_list *nxt)
Definition grid.c:138
void agerrorf(const char *fmt,...)
Definition agerror.c:165
#define B
Definition hierarchy.c:117
#define D
Definition hierarchy.c:119
#define neighbor(t, i, edim, elist)
Definition make_map.h:41
static const int dim
void remove_overlap(int dim, SparseMatrix A, double *x, double *label_sizes, int ntry, double initial_scaling, int edge_labeling_scheme, int n_constr_nodes, int *constr_nodes, SparseMatrix A_constr, bool do_shrinking)
Definition overlap.c:585
#define OverlapSmoother_struct
Definition overlap.h:18
OverlapSmoother OverlapSmoother_new(SparseMatrix A, int m, int dim, double *x, double *width, bool neighborhood_only, double *max_overlap, double *min_overlap, int edge_labeling_scheme, int n_constr_nodes, int *constr_nodes, SparseMatrix A_constr, int shrink)
@ ELSCHEME_NONE
Definition overlap.h:29
void OverlapSmoother_delete(OverlapSmoother sm)
double OverlapSmoother_smooth(OverlapSmoother sm, int dim, double *x)
#define C
Definition pack.c:30
double StressMajorizationSmoother_smooth(StressMajorizationSmoother sm, int dim, double *x, int maxit_sm)
void StressMajorizationSmoother_delete(StressMajorizationSmoother sm)
@ SM_SCHEME_NORMAL_ELABEL
@ SM_SCHEME_NORMAL
void RBDelete(rb_red_blk_tree *tree, rb_red_blk_node *z)
rb_red_blk_node * TreePredecessor(rb_red_blk_tree *tree, rb_red_blk_node *x)
void RBTreeDestroy(rb_red_blk_tree *tree)
rb_red_blk_node * RBExactQuery(rb_red_blk_tree *tree, void *q)
rb_red_blk_node * RBTreeInsert(rb_red_blk_tree *tree, void *key)
rb_red_blk_tree * RBTreeCreate(int(*CompFunc)(const void *, const void *), void(*DestFunc)(void *))
static double overlap(double i0, double i1, double j0, double j1)
Definition routespl.c:574
double average_edge_length(SparseMatrix A, int dim, double *coord)
#define RETURN(v)
Definition strmatch.c:144
Definition legal.c:50
rb_red_blk_node * nil
graphs, nodes and edges info: Agraphinfo_t, Agnodeinfo_t and Agedgeinfo_t