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