Debian Codegraph @

src/gen/lib/dotgen/mincross__c.java

raw symbols SCIP
1 /* ========================================================================
2 * PlantUML : a free UML diagram generator
3 * ========================================================================
4 *
5 * Project Info: http://plantuml.com
6 *
7 * If you like this project or if you find it useful, you can support us at:
8 *
9 * http://plantuml.com/patreon (only 1$ per month!)
10 * http://plantuml.com/paypal
11 *
12 * This file is part of Smetana.
13 * Smetana is a partial translation of Graphviz/Dot sources from C to Java.
14 *
15 * (C) Copyright 2009-2020, Arnaud Roques
16 *
17 * This translation is distributed under the same Licence as the original C program:
18 *
19 *************************************************************************
20 * Copyright (c) 2011 AT&T Intellectual Property
21 * All rights reserved. This program and the accompanying materials
22 * are made available under the terms of the Eclipse Public License v1.0
23 * which accompanies this distribution, and is available at
24 * http://www.eclipse.org/legal/epl-v10.html
25 *
26 * Contributors: See CVS logs. Details at http://www.graphviz.org/
27 *************************************************************************
28 *
29 * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
30 * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0]
31 *
32 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
33 * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
34 *
35 * You may obtain a copy of the License at
36 *
37 * http://www.eclipse.org/legal/epl-v10.html
38 *
39 * Unless required by applicable law or agreed to in writing, software
40 * distributed under the License is distributed on an "AS IS" BASIS,
41 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42 * See the License for the specific language governing permissions and
43 * limitations under the License.
44 *
45 */
46 package gen.lib.dotgen;
47 import static gen.lib.cgraph.attr__c.agget;
48 import static gen.lib.cgraph.edge__c.agfstout;
49 import static gen.lib.cgraph.edge__c.aghead;
50 import static gen.lib.cgraph.edge__c.agnxtout;
51 import static gen.lib.cgraph.edge__c.agtail;
52 import static gen.lib.cgraph.graph__c.agnedges;
53 import static gen.lib.cgraph.node__c.agfstnode;
54 import static gen.lib.cgraph.node__c.agnxtnode;
55 import static gen.lib.cgraph.obj__c.agcontains;
56 import static gen.lib.common.memory__c.zmalloc;
57 import static gen.lib.common.utils__c.dequeue;
58 import static gen.lib.common.utils__c.enqueue;
59 import static gen.lib.common.utils__c.free_queue;
60 import static gen.lib.common.utils__c.mapbool;
61 import static gen.lib.common.utils__c.new_queue;
62 import static gen.lib.dotgen.class2__c.class2;
63 import static gen.lib.dotgen.cluster__c.expand_cluster;
64 import static gen.lib.dotgen.cluster__c.install_cluster;
65 import static gen.lib.dotgen.cluster__c.mark_lowclusters;
66 import static gen.lib.dotgen.decomp__c.decompose;
67 import static gen.lib.dotgen.dotinit__c.dot_root;
68 import static gen.lib.dotgen.fastgr__c.delete_flat_edge;
69 import static gen.lib.dotgen.fastgr__c.flat_edge;
70 import static gen.lib.dotgen.fastgr__c.merge_oneway;
71 import static gen.lib.dotgen.fastgr__c.new_virtual_edge;
72 import static smetana.core.JUtils.EQ;
73 import static smetana.core.JUtils.NEQ;
74 import static smetana.core.JUtils.atof;
75 import static smetana.core.JUtils.function;
76 import static smetana.core.JUtils.qsort;
77 import static smetana.core.JUtils.size_t_array_of_integer;
78 import static smetana.core.JUtilsDebug.ENTERING;
79 import static smetana.core.JUtilsDebug.LEAVING;
80 import static smetana.core.Macro.ALLOC_Agnode_s;
81 import static smetana.core.Macro.ALLOC_INT;
82 import static smetana.core.Macro.ED_edge_type;
83 import static smetana.core.Macro.ED_head_port;
84 import static smetana.core.Macro.ED_label;
85 import static smetana.core.Macro.ED_tail_port;
86 import static smetana.core.Macro.ED_to_orig;
87 import static smetana.core.Macro.ED_to_virt;
88 import static smetana.core.Macro.ED_weight;
89 import static smetana.core.Macro.ED_xpenalty;
90 import static smetana.core.Macro.GD_clust;
91 import static smetana.core.Macro.GD_comp;
92 import static smetana.core.Macro.GD_flags;
93 import static smetana.core.Macro.GD_flip;
94 import static smetana.core.Macro.GD_has_flat_edges;
95 import static smetana.core.Macro.GD_maxrank;
96 import static smetana.core.Macro.GD_minrank;
97 import static smetana.core.Macro.GD_n_cluster;
98 import static smetana.core.Macro.GD_n_nodes;
99 import static smetana.core.Macro.GD_nlist;
100 import static smetana.core.Macro.GD_rank;
101 import static smetana.core.Macro.GD_rankleader;
102 import static smetana.core.Macro.INT_MAX;
103 import static smetana.core.Macro.MIN;
104 import static smetana.core.Macro.N;
105 import static smetana.core.Macro.ND_clust;
106 import static smetana.core.Macro.ND_coord;
107 import static smetana.core.Macro.ND_flat_in;
108 import static smetana.core.Macro.ND_flat_out;
109 import static smetana.core.Macro.ND_has_port;
110 import static smetana.core.Macro.ND_in;
111 import static smetana.core.Macro.ND_low;
112 import static smetana.core.Macro.ND_mark;
113 import static smetana.core.Macro.ND_mval;
114 import static smetana.core.Macro.ND_next;
115 import static smetana.core.Macro.ND_node_type;
116 import static smetana.core.Macro.ND_onstack;
117 import static smetana.core.Macro.ND_order;
118 import static smetana.core.Macro.ND_other;
119 import static smetana.core.Macro.ND_out;
120 import static smetana.core.Macro.ND_prev;
121 import static smetana.core.Macro.ND_rank;
122 import static smetana.core.Macro.ND_ranktype;
123 import static smetana.core.Macro.ND_weight_class;
124 import static smetana.core.Macro.NOT;
125 import static smetana.core.Macro.UNSUPPORTED;
126 import static smetana.core.Macro.elist_append;
127 import h.ST_Agedge_s;
128 import h.ST_Agnode_s;
129 import h.ST_Agraph_s;
130 import h.ST_adjmatrix_t;
131 import h.ST_elist;
132 import h.ST_nodequeue;
133 import h.ST_pointf;
134 import h.ST_rank_t;
135
136 import java.util.List;
137
138 import smetana.core.CString;
139 import smetana.core.Memory;
140 import smetana.core.Z;
141 import smetana.core.__ptr__;
142
143 public class mincross__c {
144 //1 2digov3edok6d5srhgtlmrycs
145 // extern lt_symlist_t lt_preloaded_symbols[]
146
147
148 //1 baedz5i9est5csw3epz3cv7z
149 // typedef Ppoly_t Ppolyline_t
150
151
152 //1 9k44uhd5foylaeoekf3llonjq
153 // extern Dtmethod_t* Dtset
154
155
156 //1 1ahfywsmzcpcig2oxm7pt9ihj
157 // extern Dtmethod_t* Dtbag
158
159
160 //1 anhghfj3k7dmkudy2n7rvt31v
161 // extern Dtmethod_t* Dtoset
162
163
164 //1 5l6oj1ux946zjwvir94ykejbc
165 // extern Dtmethod_t* Dtobag
166
167
168 //1 2wtf222ak6cui8cfjnw6w377z
169 // extern Dtmethod_t* Dtlist
170
171
172 //1 d1s1s6ibtcsmst88e3057u9r7
173 // extern Dtmethod_t* Dtstack
174
175
176 //1 axa7mflo824p6fspjn1rdk0mt
177 // extern Dtmethod_t* Dtqueue
178
179
180 //1 ega812utobm4xx9oa9w9ayij6
181 // extern Dtmethod_t* Dtdeque
182
183
184 //1 cyfr996ur43045jv1tjbelzmj
185 // extern Dtmethod_t* Dtorder
186
187
188 //1 wlofoiftbjgrrabzb2brkycg
189 // extern Dtmethod_t* Dttree
190
191
192 //1 12bds94t7voj7ulwpcvgf6agr
193 // extern Dtmethod_t* Dthash
194
195
196 //1 9lqknzty480cy7zsubmabkk8h
197 // extern Dtmethod_t _Dttree
198
199
200 //1 bvn6zkbcp8vjdhkccqo1xrkrb
201 // extern Dtmethod_t _Dthash
202
203
204 //1 9lidhtd6nsmmv3e7vjv9e10gw
205 // extern Dtmethod_t _Dtlist
206
207
208 //1 34ujfamjxo7xn89u90oh2k6f8
209 // extern Dtmethod_t _Dtqueue
210
211
212 //1 3jy4aceckzkdv950h89p4wjc8
213 // extern Dtmethod_t _Dtstack
214
215
216 //1 8dfqgf3u1v830qzcjqh9o8ha7
217 // extern Agmemdisc_t AgMemDisc
218
219
220 //1 18k2oh2t6llfsdc5x0wlcnby8
221 // extern Agiddisc_t AgIdDisc
222
223
224 //1 a4r7hi80gdxtsv4hdoqpyiivn
225 // extern Agiodisc_t AgIoDisc
226
227
228 //1 bnzt5syjb7mgeru19114vd6xx
229 // extern Agdisc_t AgDefaultDisc
230
231
232 //1 35y2gbegsdjilegaribes00mg
233 // extern Agdesc_t Agdirected, Agstrictdirected, Agundirected, Agstrictundirected
234
235
236 //1 c2rygslq6bcuka3awmvy2b3ow
237 // typedef Agsubnode_t Agnoderef_t
238
239
240 //1 xam6yv0dcsx57dtg44igpbzn
241 // typedef Dtlink_t Agedgeref_t
242
243
244 //1 nye6dsi1twkbddwo9iffca1j
245 // extern char *Version
246
247
248 //1 65mu6k7h7lb7bx14jpiw7iyxr
249 // extern char **Files
250
251
252 //1 2rpjdzsdyrvomf00zcs3u3dyn
253 // extern const char **Lib
254
255
256 //1 6d2f111lntd2rsdt4gswh5909
257 // extern char *CmdName
258
259
260 //1 a0ltq04fpeg83soa05a2fkwb2
261 // extern char *specificFlags
262
263
264 //1 1uv30qeqq2jh6uznlr4dziv0y
265 // extern char *specificItems
266
267
268 //1 7i4hkvngxe3x7lmg5h6b3t9g3
269 // extern char *Gvfilepath
270
271
272 //1 9jp96pa73kseya3w6sulxzok6
273 // extern char *Gvimagepath
274
275
276 //1 40ylumfu7mrvawwf4v2asvtwk
277 // extern unsigned char Verbose
278
279
280 //1 93st8awjy1z0h07n28qycbaka
281 // extern unsigned char Reduce
282
283
284 //1 f2vs67ts992erf8onwfglurzp
285 // extern int MemTest
286
287
288 //1 c6f8whijgjwwagjigmxlwz3gb
289 // extern char *HTTPServerEnVar
290
291
292 //1 cp4hzj7p87m7arw776d3bt7aj
293 // extern char *Output_file_name
294
295
296 //1 a3rqagofsgraie6mx0krzkgsy
297 // extern int graphviz_errors
298
299
300 //1 5up05203r4kxvjn1m4njcgq5x
301 // extern int Nop
302
303
304 //1 umig46cco431x14b3kosde2t
305 // extern double PSinputscale
306
307
308 //1 52bj6v8fqz39khasobljfukk9
309 // extern int Syntax_errors
310
311
312 //1 9ekf2ina8fsjj6y6i0an6somj
313 // extern int Show_cnt
314
315
316 //1 38di5qi3nkxkq65onyvconk3r
317 // extern char** Show_boxes
318
319
320 //1 6ri6iu712m8mpc7t2670etpcw
321 // extern int CL_type
322
323
324 //1 bomxiw3gy0cgd1ydqtek7fpxr
325 // extern unsigned char Concentrate
326
327
328 //1 cqy3gqgcq8empdrbnrhn84058
329 // extern double Epsilon
330
331
332 //1 64slegfoouqeg0rmbyjrm8wgr
333 // extern int MaxIter
334
335
336 //1 88wdinpnmfs4mab4aw62yb0bg
337 // extern int Ndim
338
339
340 //1 8bbad3ogcelqnnvo5br5s05gq
341 // extern int State
342
343
344 //1 17rnd8q45zclfn68qqst2vxxn
345 // extern int EdgeLabelsDone
346
347
348 //1 ymx1z4s8cznjifl2d9f9m8jr
349 // extern double Initial_dist
350
351
352 //1 a33bgl0c3uqb3trx419qulj1x
353 // extern double Damping
354
355
356 //1 d9lvrpjg1r0ojv40pod1xwk8n
357 // extern int Y_invert
358
359
360 //1 71efkfs77q5tq9ex6y0f4kanh
361 // extern int GvExitOnUsage
362
363
364 //1 4xy2dkdkv0acs2ue9eca8hh2e
365 // extern Agsym_t *G_activepencolor, *G_activefillcolor, *G_selectedpencolor, *G_selectedfillcolor, *G_visitedpencolor, *G_visitedfillcolor, *G_deletedpencolor, *G_deletedfillcolor, *G_ordering, *G_peripheries, *G_penwidth, *G_gradientangle, *G_margin
366
367
368 //1 9js5gxgzr74eakgtfhnbws3t9
369 // extern Agsym_t *N_height, *N_width, *N_shape, *N_color, *N_fillcolor, *N_activepencolor, *N_activefillcolor, *N_selectedpencolor, *N_selectedfillcolor, *N_visitedpencolor, *N_visitedfillcolor, *N_deletedpencolor, *N_deletedfillcolor, *N_fontsize, *N_fontname, *N_fontcolor, *N_margin, *N_label, *N_xlabel, *N_nojustify, *N_style, *N_showboxes, *N_sides, *N_peripheries, *N_ordering, *N_orientation, *N_skew, *N_distortion, *N_fixed, *N_imagescale, *N_layer, *N_group, *N_comment, *N_vertices, *N_z, *N_penwidth, *N_gradientangle
370
371
372 //1 anqllp9sj7wo45w6bm11j8trn
373 // extern Agsym_t *E_weight, *E_minlen, *E_color, *E_fillcolor, *E_activepencolor, *E_activefillcolor, *E_selectedpencolor, *E_selectedfillcolor, *E_visitedpencolor, *E_visitedfillcolor, *E_deletedpencolor, *E_deletedfillcolor, *E_fontsize, *E_fontname, *E_fontcolor, *E_label, *E_xlabel, *E_dir, *E_style, *E_decorate, *E_showboxes, *E_arrowsz, *E_constr, *E_layer, *E_comment, *E_label_float, *E_samehead, *E_sametail, *E_arrowhead, *E_arrowtail, *E_headlabel, *E_taillabel, *E_labelfontsize, *E_labelfontname, *E_labelfontcolor, *E_labeldistance, *E_labelangle, *E_tailclip, *E_headclip, *E_penwidth
374
375
376 //1 bh0z9puipqw7gymjd5h5b8s6i
377 // extern struct fdpParms_s* fdp_parms
378
379
380
381
382 //3 ciez0pfggxdljedzsbklq49f0
383 // static inline point pointof(int x, int y)
384 public static Object pointof(Object... arg) {
385 UNSUPPORTED("8e4tj258yvfq5uhsdpk37n5eq"); // static inline point pointof(int x, int y)
386 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
387 UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); // point r;
388 UNSUPPORTED("12jimkrzqxavaie0cpapbx18c"); // r.x = x;
389 UNSUPPORTED("7ivmviysahgsc5nn9gtp7q2if"); // r.y = y;
390 UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
391 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
392
393 throw new UnsupportedOperationException();
394 }
395
396
397
398
399 //3 c1s4k85p1cdfn176o3uryeros
400 // static inline pointf pointfof(double x, double y)
401 public static ST_pointf pointfof(double x, double y) {
402 // WARNING!! STRUCT
403 return pointfof_w_(x, y).copy();
404 }
405 private static ST_pointf pointfof_w_(double x, double y) {
406 ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof");
407 try {
408 final ST_pointf r = new ST_pointf();
409 r.setDouble("x", x);
410 r.setDouble("y", y);
411 return r;
412 } finally {
413 LEAVING("c1s4k85p1cdfn176o3uryeros","pointfof");
414 }
415 }
416
417
418
419
420 //3 7cufnfitrh935ew093mw0i4b7
421 // static inline box boxof(int llx, int lly, int urx, int ury)
422 public static Object boxof(Object... arg) {
423 UNSUPPORTED("3lzesfdd337h31jrlib1czocm"); // static inline box boxof(int llx, int lly, int urx, int ury)
424 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
425 UNSUPPORTED("52u27kayecy1i1e8bbo8f7s9r"); // box b;
426 UNSUPPORTED("cylhjlutoc0sc0uy7g98m9fb8"); // b.LL.x = llx, b.LL.y = lly;
427 UNSUPPORTED("242of6revxzx8hpe7yerrchz6"); // b.UR.x = urx, b.UR.y = ury;
428 UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); // return b;
429 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
430
431 throw new UnsupportedOperationException();
432 }
433
434
435
436
437
438
439
440 //3 1n5xl70wxuabyf97mclvilsm6
441 // static inline point add_point(point p, point q)
442 public static Object add_point(Object... arg) {
443 UNSUPPORTED("6iamka1fx8fk1rohzzse8phte"); // static inline point add_point(point p, point q)
444 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
445 UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); // point r;
446 UNSUPPORTED("3n2sizjd0civbzm6iq7su1s2p"); // r.x = p.x + q.x;
447 UNSUPPORTED("65ygdo31w09i5i6bd2f7azcd3"); // r.y = p.y + q.y;
448 UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
449 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
450
451 throw new UnsupportedOperationException();
452 }
453
454
455
456
457 //3 arrsbik9b5tnfcbzsm8gr2chx
458 // static inline pointf add_pointf(pointf p, pointf q)
459 public static ST_pointf add_pointf(final ST_pointf p, final ST_pointf q) {
460 // WARNING!! STRUCT
461 return add_pointf_w_(p.copy(), q.copy()).copy();
462 }
463 private static ST_pointf add_pointf_w_(final ST_pointf p, final ST_pointf q) {
464 ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf");
465 try {
466 final ST_pointf r = new ST_pointf();
467 r.setDouble("x", p.x + q.x);
468 r.setDouble("y", p.y + q.y);
469 return r;
470 } finally {
471 LEAVING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf");
472 }
473 }
474
475
476
477
478 //3 ai2dprak5y6obdsflguh5qbd7
479 // static inline point sub_point(point p, point q)
480 public static Object sub_point(Object... arg) {
481 UNSUPPORTED("cd602849h0bce8lu9xegka0ia"); // static inline point sub_point(point p, point q)
482 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
483 UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); // point r;
484 UNSUPPORTED("4q4q9dveah93si8ajfv59gz27"); // r.x = p.x - q.x;
485 UNSUPPORTED("9f90ik0o2yqhanzntpy3d2ydy"); // r.y = p.y - q.y;
486 UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
487 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
488
489 throw new UnsupportedOperationException();
490 }
491
492
493
494
495 //3 16f6pyogcv3j7n2p0n8giqqgh
496 // static inline pointf sub_pointf(pointf p, pointf q)
497 public static Object sub_pointf(Object... arg) {
498 UNSUPPORTED("dmufj44lddsnj0wjyxsg2fcso"); // static inline pointf sub_pointf(pointf p, pointf q)
499 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
500 UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); // pointf r;
501 UNSUPPORTED("4q4q9dveah93si8ajfv59gz27"); // r.x = p.x - q.x;
502 UNSUPPORTED("9f90ik0o2yqhanzntpy3d2ydy"); // r.y = p.y - q.y;
503 UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
504 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
505
506 throw new UnsupportedOperationException();
507 }
508
509
510
511
512 //3 9k50jgrhc4f9824vf8ony74rw
513 // static inline point mid_point(point p, point q)
514 public static Object mid_point(Object... arg) {
515 UNSUPPORTED("evy44tdsmu3erff9dp2x835u2"); // static inline point mid_point(point p, point q)
516 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
517 UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); // point r;
518 UNSUPPORTED("1a6p6fm57o0wt5ze2btsx06c7"); // r.x = (p.x + q.x) / 2;
519 UNSUPPORTED("1kbj5tgdmfi6kf4jgg6skhr6e"); // r.y = (p.y + q.y) / 2;
520 UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
521 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
522
523 throw new UnsupportedOperationException();
524 }
525
526
527
528
529 //3 59c4f7im0ftyowhnzzq2v9o1x
530 // static inline pointf mid_pointf(pointf p, pointf q)
531 public static Object mid_pointf(Object... arg) {
532 UNSUPPORTED("381o63o9kb04d7gzg65v0r3q"); // static inline pointf mid_pointf(pointf p, pointf q)
533 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
534 UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); // pointf r;
535 UNSUPPORTED("c5vboetlr3mf43wns7iik6m1w"); // r.x = (p.x + q.x) / 2.;
536 UNSUPPORTED("bcdf562ldr3bjn78hcay5xd63"); // r.y = (p.y + q.y) / 2.;
537 UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
538 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
539
540 throw new UnsupportedOperationException();
541 }
542
543
544
545
546 //3 5r18p38gisvcx3zsvbb9saixx
547 // static inline pointf interpolate_pointf(double t, pointf p, pointf q)
548 public static Object interpolate_pointf(Object... arg) {
549 UNSUPPORTED("894yimn33kmtm454llwdaotu8"); // static inline pointf interpolate_pointf(double t, pointf p, pointf q)
550 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
551 UNSUPPORTED("ef2acl8wa2ooqcb5vz3098maz"); // pointf r;
552 UNSUPPORTED("5tpwuyf5iidesy80v8o4nwkmk"); // r.x = p.x + t * (q.x - p.x);
553 UNSUPPORTED("ewnrc5uloj3w5jbmsjcn3wja0"); // r.y = p.y + t * (q.y - p.y);
554 UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
555 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
556
557 throw new UnsupportedOperationException();
558 }
559
560
561
562
563 //3 bxzrv2ghq04qk5cbyy68s4mol
564 // static inline point exch_xy(point p)
565 public static Object exch_xy(Object... arg) {
566 UNSUPPORTED("2vxya0v2fzlv5e0vjaa8d414"); // static inline point exch_xy(point p)
567 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
568 UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); // point r;
569 UNSUPPORTED("60cojdwc2h7f0m51s9jdwvup7"); // r.x = p.y;
570 UNSUPPORTED("evp2x66oa4s1tlnc0ytxq2qbq"); // r.y = p.x;
571 UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
572 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
573
574 throw new UnsupportedOperationException();
575 }
576
577
578
579
580 //3 9lt3e03tac6h6sydljrcws8fd
581 // static inline pointf exch_xyf(pointf p)
582 public static Object exch_xyf(Object... arg) {
583 UNSUPPORTED("8qamrobrqi8jsvvfrxkimrsnw"); // static inline pointf exch_xyf(pointf p)
584 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
585 UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); // pointf r;
586 UNSUPPORTED("60cojdwc2h7f0m51s9jdwvup7"); // r.x = p.y;
587 UNSUPPORTED("evp2x66oa4s1tlnc0ytxq2qbq"); // r.y = p.x;
588 UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
589 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
590
591 throw new UnsupportedOperationException();
592 }
593
594
595
596
597 //3 8l9qhieokthntzdorlu5zn29b
598 // static inline box box_bb(box b0, box b1)
599 public static Object box_bb(Object... arg) {
600 UNSUPPORTED("36et5gmnjrby6o7bq9sgh1hx6"); // static inline box box_bb(box b0, box b1)
601 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
602 UNSUPPORTED("52u27kayecy1i1e8bbo8f7s9r"); // box b;
603 UNSUPPORTED("8mr2c9xitsqi8z1plbp7ox1hu"); // b.LL.x = MIN(b0.LL.x, b1.LL.x);
604 UNSUPPORTED("2egu55ef4u1i03nwz01k7kcrl"); // b.LL.y = MIN(b0.LL.y, b1.LL.y);
605 UNSUPPORTED("9n6ei3odbgefwfxvql9whcpe"); // b.UR.x = MAX(b0.UR.x, b1.UR.x);
606 UNSUPPORTED("19ocysbuh4pxyft2bqhyhigr1"); // b.UR.y = MAX(b0.UR.y, b1.UR.y);
607 UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); // return b;
608 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
609
610 throw new UnsupportedOperationException();
611 }
612
613
614
615
616 //3 clws9h3bbjm0lw3hexf8nl4c4
617 // static inline boxf boxf_bb(boxf b0, boxf b1)
618 public static Object boxf_bb(Object... arg) {
619 UNSUPPORTED("dyrqu4ww9osr9c86gqgmifcp6"); // static inline boxf boxf_bb(boxf b0, boxf b1)
620 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
621 UNSUPPORTED("c57pq0f87j6dnbcvygu7v6k84"); // boxf b;
622 UNSUPPORTED("8mr2c9xitsqi8z1plbp7ox1hu"); // b.LL.x = MIN(b0.LL.x, b1.LL.x);
623 UNSUPPORTED("2egu55ef4u1i03nwz01k7kcrl"); // b.LL.y = MIN(b0.LL.y, b1.LL.y);
624 UNSUPPORTED("9n6ei3odbgefwfxvql9whcpe"); // b.UR.x = MAX(b0.UR.x, b1.UR.x);
625 UNSUPPORTED("19ocysbuh4pxyft2bqhyhigr1"); // b.UR.y = MAX(b0.UR.y, b1.UR.y);
626 UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); // return b;
627 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
628
629 throw new UnsupportedOperationException();
630 }
631
632
633
634
635 //3 bit6ycxo1iqd2al92y8gkzlvb
636 // static inline box box_intersect(box b0, box b1)
637 public static Object box_intersect(Object... arg) {
638 UNSUPPORTED("34gv28cldst09bl71itjgviue"); // static inline box box_intersect(box b0, box b1)
639 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
640 UNSUPPORTED("52u27kayecy1i1e8bbo8f7s9r"); // box b;
641 UNSUPPORTED("9slu7bixuymxttjic76ha2nl2"); // b.LL.x = MAX(b0.LL.x, b1.LL.x);
642 UNSUPPORTED("3uv943c2f82yuif249pf5azob"); // b.LL.y = MAX(b0.LL.y, b1.LL.y);
643 UNSUPPORTED("74tf5h16bc9zabq3s3dyny543"); // b.UR.x = MIN(b0.UR.x, b1.UR.x);
644 UNSUPPORTED("d99gcv3i7xes7y7rqf8ii20ux"); // b.UR.y = MIN(b0.UR.y, b1.UR.y);
645 UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); // return b;
646 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
647
648 throw new UnsupportedOperationException();
649 }
650
651
652
653
654 //3 8gfybie7k6pgb3o1a6llgpwng
655 // static inline boxf boxf_intersect(boxf b0, boxf b1)
656 public static Object boxf_intersect(Object... arg) {
657 UNSUPPORTED("ape22b8z6jfg17gvo42hok9eb"); // static inline boxf boxf_intersect(boxf b0, boxf b1)
658 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
659 UNSUPPORTED("c57pq0f87j6dnbcvygu7v6k84"); // boxf b;
660 UNSUPPORTED("9slu7bixuymxttjic76ha2nl2"); // b.LL.x = MAX(b0.LL.x, b1.LL.x);
661 UNSUPPORTED("3uv943c2f82yuif249pf5azob"); // b.LL.y = MAX(b0.LL.y, b1.LL.y);
662 UNSUPPORTED("74tf5h16bc9zabq3s3dyny543"); // b.UR.x = MIN(b0.UR.x, b1.UR.x);
663 UNSUPPORTED("d99gcv3i7xes7y7rqf8ii20ux"); // b.UR.y = MIN(b0.UR.y, b1.UR.y);
664 UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); // return b;
665 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
666
667 throw new UnsupportedOperationException();
668 }
669
670
671
672
673 //3 7z8j2quq65govaaejrz7b4cvb
674 // static inline int box_overlap(box b0, box b1)
675 public static Object box_overlap(Object... arg) {
676 UNSUPPORTED("1e9k599x7ygct7r4cfdxlk9u9"); // static inline int box_overlap(box b0, box b1)
677 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
678 UNSUPPORTED("7a9wwpu7dhdphd08y1ecw54w5"); // return OVERLAP(b0, b1);
679 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
680
681 throw new UnsupportedOperationException();
682 }
683
684
685
686
687 //3 4z0suuut2acsay5m8mg9dqjdu
688 // static inline int boxf_overlap(boxf b0, boxf b1)
689 public static Object boxf_overlap(Object... arg) {
690 UNSUPPORTED("905nejsewihwhhc3bhnrz9nwo"); // static inline int boxf_overlap(boxf b0, boxf b1)
691 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
692 UNSUPPORTED("7a9wwpu7dhdphd08y1ecw54w5"); // return OVERLAP(b0, b1);
693 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
694
695 throw new UnsupportedOperationException();
696 }
697
698
699
700
701 //3 dd34swz5rmdgu3a2np2a4h1dy
702 // static inline int box_contains(box b0, box b1)
703 public static Object box_contains(Object... arg) {
704 UNSUPPORTED("aputfc30fjkvy6jx4otljaczq"); // static inline int box_contains(box b0, box b1)
705 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
706 UNSUPPORTED("87ap80vrh2a4gpprbxr33lrg3"); // return CONTAINS(b0, b1);
707 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
708
709 throw new UnsupportedOperationException();
710 }
711
712
713
714
715 //3 8laj1bspbu2i1cjd9upr7xt32
716 // static inline int boxf_contains(boxf b0, boxf b1)
717 public static Object boxf_contains(Object... arg) {
718 UNSUPPORTED("7ccnttkiwt834yfyw0evcm18v"); // static inline int boxf_contains(boxf b0, boxf b1)
719 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
720 UNSUPPORTED("87ap80vrh2a4gpprbxr33lrg3"); // return CONTAINS(b0, b1);
721 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
722
723 throw new UnsupportedOperationException();
724 }
725
726
727
728
729 //3 4wf5swkz24xx51ja2dynbycu1
730 // static inline pointf perp (pointf p)
731 public static Object perp(Object... arg) {
732 UNSUPPORTED("567wpqlg9rv63ynyvxd9sgkww"); // static inline pointf perp (pointf p)
733 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
734 UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); // pointf r;
735 UNSUPPORTED("2fyydy6t6yifjsczccsb9szeg"); // r.x = -p.y;
736 UNSUPPORTED("evp2x66oa4s1tlnc0ytxq2qbq"); // r.y = p.x;
737 UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
738 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
739
740 throw new UnsupportedOperationException();
741 }
742
743
744
745
746 //3 6dtlpzv4mvgzb9o0b252yweuv
747 // static inline pointf scale (double c, pointf p)
748 public static Object scale(Object... arg) {
749 UNSUPPORTED("c1ngytew34bmkdb7vps5h3dh8"); // static inline pointf scale (double c, pointf p)
750 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
751 UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); // pointf r;
752 UNSUPPORTED("dznf7nac14snww4usquyd6r3r"); // r.x = c * p.x;
753 UNSUPPORTED("33kk73m8vjcux5tnjl8co2pe6"); // r.y = c * p.y;
754 UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
755 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
756
757 throw new UnsupportedOperationException();
758 }
759
760
761
762
763 //3 7ye0tsa8kll1jntdcqzsgjp0q
764 // static int gd_minrank(Agraph_t *g)
765 public static Object gd_minrank(Object... arg) {
766 UNSUPPORTED("7wnr5wvv8mw2d3mfdyvdz5kz9"); // static int gd_minrank(Agraph_t *g) {return GD_minrank(g);}
767
768 throw new UnsupportedOperationException();
769 }
770
771
772
773
774 //3 c7dhattawtph3qv1eeoafltk0
775 // static int gd_maxrank(Agraph_t *g)
776 public static Object gd_maxrank(Object... arg) {
777 UNSUPPORTED("b89n5iyqsgra9z559023bf23e"); // static int gd_maxrank(Agraph_t *g) {return GD_maxrank(g);}
778
779 throw new UnsupportedOperationException();
780 }
781
782
783
784
785 //3 8g2can1ih1668s30s6d7wny5b
786 // static rank_t *gd_rank(Agraph_t *g, int r)
787 public static Object gd_rank(Object... arg) {
788 UNSUPPORTED("bxd4rm18v4y2x6fo30vh9pauo"); // static rank_t *gd_rank(Agraph_t *g, int r) {return &GD_rank(g)[r];}
789
790 throw new UnsupportedOperationException();
791 }
792
793
794
795
796 //3 8pjrnrvidhpqcubvkk5lsfp6
797 // static int nd_order(Agnode_t *v)
798 public static Object nd_order(Object... arg) {
799 UNSUPPORTED("f4zvlmxyp6gei8iiu33hpz4oe"); // static int nd_order(Agnode_t *v) { return ND_order(v); }
800
801 throw new UnsupportedOperationException();
802 }
803
804
805 //1 eusjqny3hma23wvcznk9arpgr
806 // static int MinQuit
807 //private static int MinQuit;
808
809 //1 eykidmlm64erbhaultu3js822
810 // static double Convergence
811 //private static double Convergence;
812
813 //1 f2ssditidb9f1cgp7r1kslp0e
814 // static graph_t *Root
815 //private static Agraph_s Root;
816
817 //1 ager0orj38x5rjuhzv1o2cxuc
818 // static int GlobalMinRank, GlobalMaxRank
819 //private static int GlobalMinRank, GlobalMaxRank;
820
821 //1 dag2n5hcww3ada79u52a8yha6
822 // static edge_t **TE_list
823 //private static __ptr__ TE_list;
824
825 //1 agrg82s0nsmuokh0t3h5q6h90
826 // static int *TI_list
827 // private static __ptr__ TI_list;
828
829 //1 7x0e0qfe96o5elb6lxt8mfmho
830 // static boolean ReMincross
831 //private static boolean ReMincross;
832
833
834
835 //3 e876vp4hgkzshluz6qk77cjwk
836 // void dot_mincross(graph_t * g, int doBalance)
837 public static void dot_mincross(ST_Agraph_s g, boolean doBalance) {
838 ENTERING("e876vp4hgkzshluz6qk77cjwk","dot_mincross");
839 try {
840 int c, nc;
841 CString s;
842 init_mincross(g);
843 for (nc = c = 0; c < GD_comp(g).size; c++) {
844 init_mccomp(g, c);
845 nc += mincross_(g, 0, 2, doBalance);
846 }
847 merge2(g);
848 /* run mincross on contents of each cluster */
849 for (c = 1; c <= GD_n_cluster(g); c++) {
850 nc += mincross_clust(g, (ST_Agraph_s) GD_clust(g).get(c).getPtr(), doBalance);
851 }
852 if ((GD_n_cluster(g) > 0)
853 && (N(s = agget(g, new CString("remincross"))) || (mapbool(s)))) {
854 mark_lowclusters(g);
855 Z.z().ReMincross = NOT(0);
856 nc = mincross_(g, 2, 2, doBalance);
857 }
858 cleanup2(g, nc);
859 } finally {
860 LEAVING("e876vp4hgkzshluz6qk77cjwk","dot_mincross");
861 }
862 }
863
864
865
866
867 //3 756bre1tpxb1tq68p7xhkrxkc
868 // static adjmatrix_t *new_matrix(int i, int j)
869 public static ST_adjmatrix_t new_matrix(int i, int j) {
870 ENTERING("756bre1tpxb1tq68p7xhkrxkc","new_matrix");
871 try {
872 ST_adjmatrix_t rv = new ST_adjmatrix_t();
873 rv.nrows = i;
874 rv.ncols = j;
875 rv.data = new int[i][j]; // Or maybe new int[j][i] ?
876 return rv;
877 } finally {
878 LEAVING("756bre1tpxb1tq68p7xhkrxkc","new_matrix");
879 }
880 }
881
882
883
884
885 //3 1n1e0k0wtlbugwm3cb4na6av6
886 // static void free_matrix(adjmatrix_t * p)
887 public static void free_matrix(ST_adjmatrix_t p) {
888 ENTERING("1n1e0k0wtlbugwm3cb4na6av6","free_matrix");
889 try {
890 if (p!=null) {
891 Memory.free(p.data);
892 Memory.free(p);
893 }
894 } finally {
895 LEAVING("1n1e0k0wtlbugwm3cb4na6av6","free_matrix");
896 }
897 }
898
899
900
901
902 //3 49vw7fkn99wbojtfksugvuruh
903 // static void init_mccomp(graph_t * g, int c)
904 public static void init_mccomp(ST_Agraph_s g, int c) {
905 ENTERING("49vw7fkn99wbojtfksugvuruh","init_mccomp");
906 try {
907 int r;
908 // GD_nlist(g, GD_comp(g).getFromListt(c).getPtr());
909 GD_nlist(g, GD_comp(g).getFromList(c));
910 if (c > 0) {
911 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
912 GD_rank(g).plus(r).setPtr("v", GD_rank(g).get(r).v.plus(GD_rank(g).get(r).n));
913 GD_rank(g).plus(r).setInt("n", 0);
914 }
915 }
916 } finally {
917 LEAVING("49vw7fkn99wbojtfksugvuruh","init_mccomp");
918 }
919 }
920
921
922
923
924 //3 72v5zs502m1of3vsofyfo15ap
925 // static int betweenclust(edge_t * e)
926 public static Object betweenclust(Object... arg) {
927 UNSUPPORTED("6k6r73j7gctt4ntepjubrlfze"); // static int betweenclust(edge_t * e)
928 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
929 UNSUPPORTED("1z9f8ptfggp4qlwv5cdd55i3j"); // while (ED_to_orig(e))
930 UNSUPPORTED("bdmai1d040qmubf08ds339v9x"); // e = ED_to_orig(e);
931 UNSUPPORTED("eq2o4v9qo3xx42in97ssadek"); // return (ND_clust(agtail(e)) != ND_clust(aghead(e)));
932 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
933
934 throw new UnsupportedOperationException();
935 }
936
937
938
939
940 //3 760bwoz4twwy2jr1b32r6zefi
941 // static void do_ordering_node (graph_t * g, node_t* n, int outflag)
942 public static Object do_ordering_node(Object... arg) {
943 UNSUPPORTED("ajn55zvrzf8njqkshll3kaz88"); // static void do_ordering_node (graph_t * g, node_t* n, int outflag)
944 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
945 UNSUPPORTED("bp5tdulayknsvyv8a2j2tinh"); // int i, ne;
946 UNSUPPORTED("5yrhx4blosxo5xnc1nh1kzhfs"); // node_t *u, *v;
947 UNSUPPORTED("9cbk3ly04nbzqoxmmjwptqq9a"); // edge_t *e, *f, *fe;
948 UNSUPPORTED("5ol5beitdgh7axwpk35pc9trm"); // edge_t **sortlist = TE_list;
949 UNSUPPORTED("aeria2or5qpnnrr9wm15k588l"); // if (ND_clust(n))
950 UNSUPPORTED("a7fgam0j0jm7bar0mblsv3no4"); // return;
951 UNSUPPORTED("442hvc4h32o6e3cvzm5y5y3oq"); // if (outflag) {
952 UNSUPPORTED("7xi4jdz18dyv740agfh5uwtxv"); // for (i = ne = 0; (e = ND_out(n).list[i]); i++)
953 UNSUPPORTED("24smn55xhvkklh2do2cfcmy98"); // if (!betweenclust(e))
954 UNSUPPORTED("ouas2w3lk54dwigzgglm3w7r"); // sortlist[ne++] = e;
955 UNSUPPORTED("c07up7zvrnu2vhzy6d7zcu94g"); // } else {
956 UNSUPPORTED("6dgl0skwzmsi69ugcewc5vwaf"); // for (i = ne = 0; (e = ND_in(n).list[i]); i++)
957 UNSUPPORTED("24smn55xhvkklh2do2cfcmy98"); // if (!betweenclust(e))
958 UNSUPPORTED("ouas2w3lk54dwigzgglm3w7r"); // sortlist[ne++] = e;
959 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
960 UNSUPPORTED("hdnqvw2crdbzt2uenqso4l7k"); // if (ne <= 1)
961 UNSUPPORTED("a7fgam0j0jm7bar0mblsv3no4"); // return;
962 UNSUPPORTED("4zkjvsomlyhcl06ummf4gz0d2"); // /* write null terminator at end of list.
963 UNSUPPORTED("2zx16rdu8hp86z3z36natgy8t"); // requires +1 in TE_list alloccation */
964 UNSUPPORTED("6dp57feioscwstrfmhqhrz1jx"); // sortlist[ne] = 0;
965 UNSUPPORTED("4wqnlh6z9lr2xvmjp95nozn84"); // qsort(sortlist, ne, sizeof(sortlist[0]), (qsort_cmpf) edgeidcmpf);
966 UNSUPPORTED("d6aia9q03brt8otnyu5m3tlxj"); // for (ne = 1; (f = sortlist[ne]); ne++) {
967 UNSUPPORTED("1b9ylnvr8zscovbyrxoe9ypax"); // e = sortlist[ne - 1];
968 UNSUPPORTED("4nbrepm0pmohxxml0csb9j5xc"); // if (outflag) {
969 UNSUPPORTED("2rcn453iomwvou108kjr2rboc"); // u = aghead(e);
970 UNSUPPORTED("96i3kysq5lfoyukhe65vpiah2"); // v = aghead(f);
971 UNSUPPORTED("7yhr8hn3r6wohafwxrt85b2j2"); // } else {
972 UNSUPPORTED("96jttvtco2oqt3y3qr5fbhu1j"); // u = agtail(e);
973 UNSUPPORTED("8g5mzwux62x43bjzeslylyi0g"); // v = agtail(f);
974 UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
975 UNSUPPORTED("a7mygw39shaa9w4l8fdlgqr0i"); // if (find_flat_edge(u, v))
976 UNSUPPORTED("6cprbghvenu9ldc0ez1ifc63q"); // return;
977 UNSUPPORTED("aoa2embk8eaij29q6nbl4e5tk"); // fe = new_virtual_edge(u, v, NULL);
978 UNSUPPORTED("67t5g8eu9tdqbnwj4s4g6ah6u"); // ED_edge_type(fe) = 4;
979 UNSUPPORTED("b32n066t1nkgj646wvo7vuwlq"); // flat_edge(g, fe);
980 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
981 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
982
983 throw new UnsupportedOperationException();
984 }
985
986
987
988
989 //3 815nmj2gcomtex4yfclqde12j
990 // static void do_ordering(graph_t * g, int outflag)
991 public static Object do_ordering(Object... arg) {
992 UNSUPPORTED("9v68euuxlii02rb5mhlyd8alp"); // static void do_ordering(graph_t * g, int outflag)
993 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
994 UNSUPPORTED("5y5mm5obhrqt745c4fx4o0r56"); // /* Order all nodes in graph */
995 UNSUPPORTED("cjx5v6hayed3q8eeub1cggqca"); // node_t *n;
996 UNSUPPORTED("44thr6ep72jsj3fksjiwdx3yr"); // for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
997 UNSUPPORTED("bicm0b87pp2rusaezmk6qigjq"); // do_ordering_node (g, n, outflag);
998 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
999 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
1000
1001 throw new UnsupportedOperationException();
1002 }
1003
1004
1005
1006
1007 //3 svq3i3c6yw3cbfwaeip5dfuy
1008 // static void do_ordering_for_nodes(graph_t * g)
1009 public static Object do_ordering_for_nodes(Object... arg) {
1010 UNSUPPORTED("7yd9vingwgdcdtrx0p38jti00"); // static void do_ordering_for_nodes(graph_t * g)
1011 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
1012 UNSUPPORTED("887aairlqk73reuayo3hz67v3"); // /* Order nodes which have the "ordered" attribute */
1013 UNSUPPORTED("cjx5v6hayed3q8eeub1cggqca"); // node_t *n;
1014 UNSUPPORTED("cbbfhy5qk3dailijtedj1czut"); // const char *ordering;
1015 UNSUPPORTED("44thr6ep72jsj3fksjiwdx3yr"); // for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
1016 UNSUPPORTED("ekvbu44bbrdwkw71yd21dbns9"); // if ((ordering = late_string(n, N_ordering, NULL))) {
1017 UNSUPPORTED("7jueg5punlemj6mfbpgltb5u8"); // if ((*(ordering)==*("out")&&!strcmp(ordering,"out")))
1018 UNSUPPORTED("302oz5j9wva90otn6jq513bme"); // do_ordering_node(g, n, NOT(0));
1019 UNSUPPORTED("1dt1hft3eak5ytycs6dh7yk0"); // else if ((*(ordering)==*("in")&&!strcmp(ordering,"in")))
1020 UNSUPPORTED("dnig45so0x904azp9fhxymqjn"); // do_ordering_node(g, n, 0);
1021 UNSUPPORTED("2rxgmu8cktngvqtsex2rlbjed"); // else if (ordering[0])
1022 UNSUPPORTED("axk3fxl1bh09n475kmcx42kdu"); // agerr(AGERR, "ordering '%s' not recognized for node '%s'.\n", ordering, agnameof(n));
1023 UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
1024 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1025 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
1026
1027 throw new UnsupportedOperationException();
1028 }
1029
1030
1031
1032
1033 //3 hzoz2czb672i0nbjvjhbc3na
1034 // static void ordered_edges(graph_t * g)
1035 public static void ordered_edges(ST_Agraph_s g) {
1036 ENTERING("hzoz2czb672i0nbjvjhbc3na","ordered_edges");
1037 try {
1038 CString ordering;
1039 if (N(Z.z().G_ordering) && N(Z.z().N_ordering))
1040 return;
1041 UNSUPPORTED("98iqppixxkdndoz210i5ejppy"); // if ((ordering = late_string(g, G_ordering, NULL))) {
1042 UNSUPPORTED("lhhw62wj3on36enoy6ug6u1p"); // if ((*(ordering)==*("out")&&!strcmp(ordering,"out")))
1043 UNSUPPORTED("ctbadiyd3jjtlt2f5t9p94au7"); // do_ordering(g, NOT(0));
1044 UNSUPPORTED("259y9uhqwc8w6jhrpm1eaa7hf"); // else if ((*(ordering)==*("in")&&!strcmp(ordering,"in")))
1045 UNSUPPORTED("312ij4z5d42rye9s30l9io097"); // do_ordering(g, 0);
1046 UNSUPPORTED("25yw5chxmy54pmo88tre1w2ir"); // else if (ordering[0])
1047 UNSUPPORTED("5ugg9zy8378pijqru97mxmen5"); // agerr(AGERR, "ordering '%s' not recognized.\n", ordering);
1048 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1049 UNSUPPORTED("div10atae09n36x269sl208r1"); // else
1050 UNSUPPORTED("6ld19omy1z68vprfzbhrjqr2z"); // {
1051 UNSUPPORTED("50itbchatjp61haxvg3xnhvoo"); // graph_t *subg;
1052 UNSUPPORTED("evzjoqkm2xukapjvpccu2f23e"); // for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
1053 UNSUPPORTED("1016hqxaexp4j33vmkzvdpq80"); // /* clusters are processed by separate calls to ordered_edges */
1054 UNSUPPORTED("7ah0zlu96u6g6cquxebenj4z3"); // if (!is_cluster(subg))
1055 UNSUPPORTED("7sqzaehh40dvpm11hlxhef6cw"); // ordered_edges(subg);
1056 UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
1057 UNSUPPORTED("h2b3ao18r091ie7yk9v20pqq"); // if (N_ordering) do_ordering_for_nodes (g);
1058 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1059 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
1060
1061 throw new UnsupportedOperationException();
1062 } finally {
1063 LEAVING("hzoz2czb672i0nbjvjhbc3na","ordered_edges");
1064 }
1065 }
1066
1067
1068
1069
1070 //3 crwc5qe7fmrpgcqh1a80toyvo
1071 // static int mincross_clust(graph_t * par, graph_t * g, int doBalance)
1072 public static int mincross_clust(ST_Agraph_s par, ST_Agraph_s g, boolean doBalance) {
1073 ENTERING("crwc5qe7fmrpgcqh1a80toyvo","mincross_clust");
1074 try {
1075 int c, nc;
1076 expand_cluster(g);
1077 ordered_edges(g);
1078 flat_breakcycles(g);
1079 flat_reorder(g);
1080 nc = mincross_(g, 2, 2, doBalance);
1081 for (c = 1; c <= GD_n_cluster(g); c++)
1082 nc += mincross_clust(g, (ST_Agraph_s) GD_clust(g).get(c).getPtr(), doBalance);
1083 save_vlist(g);
1084 return nc;
1085 } finally {
1086 LEAVING("crwc5qe7fmrpgcqh1a80toyvo","mincross_clust");
1087 }
1088 }
1089
1090
1091
1092
1093 //3 657v773m21j5w3g3v94o7464t
1094 // static int left2right(graph_t * g, node_t * v, node_t * w)
1095 public static boolean left2right(ST_Agraph_s g, ST_Agnode_s v, ST_Agnode_s w) {
1096 ENTERING("657v773m21j5w3g3v94o7464t","left2right");
1097 try {
1098 ST_adjmatrix_t M;
1099 boolean rv=false;
1100 /* CLUSTER indicates orig nodes of clusters, and vnodes of skeletons */
1101 if (Z.z().ReMincross == false) {
1102 if (NEQ(ND_clust(v), ND_clust(w)) && (ND_clust(v)!=null) && (ND_clust(w)!=null)) {
1103 /* the following allows cluster skeletons to be swapped */
1104 if ((ND_ranktype(v) == 7)
1105 && (ND_node_type(v) == 1))
1106 return false;
1107 if ((ND_ranktype(w) == 7)
1108 && (ND_node_type(w) == 1))
1109 return false;
1110 return NOT(false);
1111 /*return ((ND_ranktype(v) != CLUSTER) && (ND_ranktype(w) != CLUSTER)); */
1112 }
1113 } else {
1114 if (NEQ(ND_clust(v), ND_clust(w)))
1115 return NOT(0);
1116 }
1117 M = (ST_adjmatrix_t) GD_rank(g).plus(ND_rank(v)).getPtr().flat;
1118 if (M == null)
1119 rv = false;
1120 else {
1121 if (GD_flip(g)!=0) {
1122 ST_Agnode_s t = v;
1123 v = w;
1124 w = t;
1125 }
1126 rv = M.data[ND_low(v)][ND_low(w)]!=0;
1127 }
1128 return rv;
1129 } finally {
1130 LEAVING("657v773m21j5w3g3v94o7464t","left2right");
1131 }
1132 }
1133
1134
1135
1136
1137 //3 daknncpjy7g5peiicolbmh55i
1138 // static int in_cross(node_t * v, node_t * w)
1139 public static int in_cross(ST_Agnode_s v, ST_Agnode_s w) {
1140 ENTERING("daknncpjy7g5peiicolbmh55i","in_cross");
1141 try {
1142 List<ST_Agedge_s> e2_ = ND_in(w).list;
1143 int inv, cross = 0, t;
1144 for (int ie2 = 0; e2_.get(ie2)!=null; ie2++) {
1145 int cnt = ED_xpenalty(e2_.get(ie2));
1146 inv = ND_order((agtail(e2_.get(ie2))));
1147 List<ST_Agedge_s> e1_ = ND_in(v).list;
1148 for (int ie1 = 0; e1_.get(ie1)!=null; ie1++) {
1149 t = ND_order(agtail(e1_.get(ie1))) - inv;
1150 if ((t > 0)
1151 || ((t == 0)
1152 && ( ED_tail_port(e1_.get(ie1)).p.x > ED_tail_port(e2_.get(ie2)).p.x)))
1153 cross += ED_xpenalty(e1_.get(ie1)) * cnt;
1154 }
1155 }
1156 return cross;
1157 } finally {
1158 LEAVING("daknncpjy7g5peiicolbmh55i","in_cross");
1159 }
1160 }
1161
1162
1163
1164
1165 //3 b7mf74np8ewrgzwd5u0o8fqod
1166 // static int out_cross(node_t * v, node_t * w)
1167 public static int out_cross(ST_Agnode_s v, ST_Agnode_s w) {
1168 ENTERING("b7mf74np8ewrgzwd5u0o8fqod","out_cross");
1169 try {
1170 List<ST_Agedge_s> e2_ = ND_out(w).list;
1171 int inv, cross = 0, t;
1172 for (int ie2 = 0; e2_.get(ie2)!=null; ie2++) {
1173 int cnt = ED_xpenalty(e2_.get(ie2));
1174 inv = ND_order(aghead(e2_.get(ie2)));
1175 List<ST_Agedge_s> e1_ = ND_out(v).list;
1176 for (int ie1 = 0; e1_.get(ie1)!=null; ie1++) {
1177 t = ND_order(aghead(e1_.get(ie1))) - inv;
1178 if ((t > 0)
1179 || ((t == 0)
1180 && ((ED_head_port(e1_.get(ie1))).p.x) > (ED_head_port(e2_.get(ie2))).p.x))
1181 cross += ((ED_xpenalty(e1_.get(ie1))) * cnt);
1182 }
1183 }
1184 return cross;
1185 } finally {
1186 LEAVING("b7mf74np8ewrgzwd5u0o8fqod","out_cross");
1187 }
1188 }
1189
1190
1191
1192
1193 //3 ba4tbr57wips1dzpgxzx3b6ja
1194 // static void exchange(node_t * v, node_t * w)
1195 public static void exchange(ST_Agnode_s v, ST_Agnode_s w) {
1196 ENTERING("ba4tbr57wips1dzpgxzx3b6ja","exchange");
1197 try {
1198 int vi, wi, r;
1199 r = ND_rank(v);
1200 vi = ND_order(v);
1201 wi = ND_order(w);
1202 ND_order(v, wi);
1203 GD_rank(Z.z().Root).get(r).v.plus(wi).setPtr(v);
1204 ND_order(w, vi);
1205 GD_rank(Z.z().Root).get(r).v.plus(vi).setPtr(w);
1206 } finally {
1207 LEAVING("ba4tbr57wips1dzpgxzx3b6ja","exchange");
1208 }
1209 }
1210
1211
1212
1213
1214 //3 dzkv88lq5zv0g3yo7bf90qgr7
1215 // static void balanceNodes(graph_t * g, int r, node_t * v, node_t * w)
1216 public static Object balanceNodes(Object... arg) {
1217 UNSUPPORTED("504qsj6detmzllj50pno6sdx4"); // static void balanceNodes(graph_t * g, int r, node_t * v, node_t * w)
1218 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
1219 UNSUPPORTED("dor7xumwnqvymg7xdesa6pxqn"); // node_t *s; /* separator node */
1220 UNSUPPORTED("c6s55weiu8hc4voeunxf2utru"); // int sepIndex;
1221 UNSUPPORTED("6gqdkaiir2naiawry8cnlpf4a"); // int nullType; /* type of null nodes */
1222 UNSUPPORTED("2dqxr1ujg381s9ugf0367iici"); // int cntDummy = 0, cntOri = 0;
1223 UNSUPPORTED("7yj94w2zpwdubyzymyljw490a"); // int k = 0, m = 0, k1 = 0, m1 = 0, i = 0;
1224 UNSUPPORTED("6mq7c2z232o8kvpp371lfmewh"); // /* we only consider v and w of different types */
1225 UNSUPPORTED("53kjkk6c0h35zpbikj9y2q6b4"); // if (ND_node_type(v) == ND_node_type(w))
1226 UNSUPPORTED("a7fgam0j0jm7bar0mblsv3no4"); // return;
1227 UNSUPPORTED("5ylcsv8rwps97qz7sdftpwrka"); // /* count the number of dummy and original nodes */
1228 UNSUPPORTED("5025o4uc5dkbxf3smi3kmfoit"); // for (i = 0; i < GD_rank(g)[r].n; i++) {
1229 UNSUPPORTED("d87qjwxc2qjvh6hb9fmi9y9vq"); // if (ND_node_type(GD_rank(g)[r].v[i]) == 0)
1230 UNSUPPORTED("dcny4syjny1sh20jyjjl7jj62"); // cntOri++;
1231 UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); // else
1232 UNSUPPORTED("bbpsgrsgquajs3xxqzeqvgv6n"); // cntDummy++;
1233 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1234 UNSUPPORTED("2qx27p3loyln3i09ycwf5p1dh"); // if (cntOri < cntDummy) {
1235 UNSUPPORTED("ex9drrxqg8zalagzrnvrulrlb"); // if (ND_node_type(v) == 0)
1236 UNSUPPORTED("jtm789r1sqidxc39d09n9det"); // s = v;
1237 UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); // else
1238 UNSUPPORTED("c31t0vnbzvj9zml7p91syjzep"); // s = w;
1239 UNSUPPORTED("c07up7zvrnu2vhzy6d7zcu94g"); // } else {
1240 UNSUPPORTED("ex9drrxqg8zalagzrnvrulrlb"); // if (ND_node_type(v) == 0)
1241 UNSUPPORTED("c31t0vnbzvj9zml7p91syjzep"); // s = w;
1242 UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); // else
1243 UNSUPPORTED("jtm789r1sqidxc39d09n9det"); // s = v;
1244 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1245 UNSUPPORTED("ejbeaepbxwawm7mvtusyi2x57"); // /* get the separator node index */
1246 UNSUPPORTED("5025o4uc5dkbxf3smi3kmfoit"); // for (i = 0; i < GD_rank(g)[r].n; i++) {
1247 UNSUPPORTED("afetrkwabtn6v07evr5japsk5"); // if (GD_rank(g)[r].v[i] == s)
1248 UNSUPPORTED("bvwqg08b9hn6rfdx11sjq0hgc"); // sepIndex = i;
1249 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1250 UNSUPPORTED("ecis6irl9vire6ejfrshttjk4"); // nullType = (ND_node_type(s) == 0) ? 1 : 0;
1251 UNSUPPORTED("1i78b3w9omzkba0pmafwfunbj"); // /* count the number of null nodes to the left and
1252 UNSUPPORTED("1f2jn45p7wv1ud964k43lgdss"); // * right of the separator node
1253 UNSUPPORTED("795vpnc8yojryr8b46aidsu69"); // */
1254 UNSUPPORTED("5l8w7t0ta6p6hnfp72l7lbqey"); // for (i = sepIndex - 1; i >= 0; i--) {
1255 UNSUPPORTED("49j09cv8f8ien7kqoguzywjmw"); // if (ND_node_type(GD_rank(g)[r].v[i]) == nullType)
1256 UNSUPPORTED("borg3y7rgdooetc6ckrsrg9fc"); // k++;
1257 UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); // else
1258 UNSUPPORTED("ai3czg6gaaxspsmndknpyvuiu"); // break;
1259 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1260 UNSUPPORTED("cuj70hyout6yv30drqkjiwllo"); // for (i = sepIndex + 1; i < GD_rank(g)[r].n; i++) {
1261 UNSUPPORTED("49j09cv8f8ien7kqoguzywjmw"); // if (ND_node_type(GD_rank(g)[r].v[i]) == nullType)
1262 UNSUPPORTED("d35zlcj7podjjns9eg2ttocr7"); // m++;
1263 UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); // else
1264 UNSUPPORTED("ai3czg6gaaxspsmndknpyvuiu"); // break;
1265 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1266 UNSUPPORTED("9r0b42aqwdlx2cg7aqsxgle1o"); // /* now exchange v,w and calculate the same counts */
1267 UNSUPPORTED("cvktng9nwm6futhlv28bqbqy"); // exchange(v, w);
1268 UNSUPPORTED("ejbeaepbxwawm7mvtusyi2x57"); // /* get the separator node index */
1269 UNSUPPORTED("5025o4uc5dkbxf3smi3kmfoit"); // for (i = 0; i < GD_rank(g)[r].n; i++) {
1270 UNSUPPORTED("afetrkwabtn6v07evr5japsk5"); // if (GD_rank(g)[r].v[i] == s)
1271 UNSUPPORTED("bvwqg08b9hn6rfdx11sjq0hgc"); // sepIndex = i;
1272 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1273 UNSUPPORTED("1i78b3w9omzkba0pmafwfunbj"); // /* count the number of null nodes to the left and
1274 UNSUPPORTED("1f2jn45p7wv1ud964k43lgdss"); // * right of the separator node
1275 UNSUPPORTED("795vpnc8yojryr8b46aidsu69"); // */
1276 UNSUPPORTED("5l8w7t0ta6p6hnfp72l7lbqey"); // for (i = sepIndex - 1; i >= 0; i--) {
1277 UNSUPPORTED("49j09cv8f8ien7kqoguzywjmw"); // if (ND_node_type(GD_rank(g)[r].v[i]) == nullType)
1278 UNSUPPORTED("eer25fyjj3njh33v709xj07lk"); // k1++;
1279 UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); // else
1280 UNSUPPORTED("ai3czg6gaaxspsmndknpyvuiu"); // break;
1281 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1282 UNSUPPORTED("cuj70hyout6yv30drqkjiwllo"); // for (i = sepIndex + 1; i < GD_rank(g)[r].n; i++) {
1283 UNSUPPORTED("49j09cv8f8ien7kqoguzywjmw"); // if (ND_node_type(GD_rank(g)[r].v[i]) == nullType)
1284 UNSUPPORTED("80ptwhmp1gyks2xfkcjub24o9"); // m1++;
1285 UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); // else
1286 UNSUPPORTED("ai3czg6gaaxspsmndknpyvuiu"); // break;
1287 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1288 UNSUPPORTED("6yjcl5tugkib89c3p3beoi0cs"); // if (abs(k1 - m1) > abs(k - m)) {
1289 UNSUPPORTED("4hhzcihijbcjb2mo6eop9g855"); // exchange(v, w); //revert to the original ordering
1290 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1291 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
1292
1293 throw new UnsupportedOperationException();
1294 }
1295
1296
1297
1298
1299 //3 72rj5xs4qh00oh2yi1h5qaadu
1300 // static int balance(graph_t * g)
1301 public static Object balance(Object... arg) {
1302 UNSUPPORTED("4223t6rekw3qd8eksvz9kjcqh"); // static int balance(graph_t * g)
1303 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
1304 UNSUPPORTED("970giwpms1ljmt0px5djlqs0z"); // int i, c0, c1, rv;
1305 UNSUPPORTED("8xqnhjfdqnlwlyld1ep6hpnmb"); // node_t *v, *w;
1306 UNSUPPORTED("p6jnh7nvcpnl3zbz636pskbs"); // int r;
1307 UNSUPPORTED("yy0fwjrmxw3jbi85mvwrka7f"); // rv = 0;
1308 UNSUPPORTED("9ey19t6tw2srzaedeng4sq96z"); // for (r = GD_maxrank(g); r >= GD_minrank(g); r--) {
1309 UNSUPPORTED("2nlemgjbnd1ygry42bcbuwo9y"); // GD_rank(g)[r].candidate = 0;
1310 UNSUPPORTED("91gzxbmcoy5xbvf8nlhmlj4eh"); // for (i = 0; i < GD_rank(g)[r].n - 1; i++) {
1311 UNSUPPORTED("5ekdr3i8niy7x2ohi7ftgmjke"); // v = GD_rank(g)[r].v[i];
1312 UNSUPPORTED("efwyjm6j3e7byt6z83lrhgd1r"); // w = GD_rank(g)[r].v[i + 1];
1313 UNSUPPORTED("8ey6umhtefcrb61ncgis82hw6"); // assert(ND_order(v) < ND_order(w));
1314 UNSUPPORTED("ddkyq74d5rjfcofczt4hmkxsj"); // if (left2right(g, v, w))
1315 UNSUPPORTED("6hyelvzskqfqa07xtgjtvg2is"); // continue;
1316 UNSUPPORTED("cdpfb5fmlhe0831jf96pjp9s0"); // c0 = c1 = 0;
1317 UNSUPPORTED("3l676z6ajeugxvie4r957jap3"); // if (r > 0) {
1318 UNSUPPORTED("ennnd5cl9xhh55j2bni58iuxv"); // c0 += in_cross(v, w);
1319 UNSUPPORTED("bk4dl2r7nw7j8xvkpg7g7x0z9"); // c1 += in_cross(w, v);
1320 UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
1321 UNSUPPORTED("f0ordylgf44hx2l90eof067yo"); // if (GD_rank(g)[r + 1].n > 0) {
1322 UNSUPPORTED("d945airzpo5xbu0fz68ylmgql"); // c0 += out_cross(v, w);
1323 UNSUPPORTED("e6ez0uwca50uwo7i7i4vak4f2"); // c1 += out_cross(w, v);
1324 UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
1325 UNSUPPORTED("884yfwkgyw57w5ivpfrggmq15"); // if (c1 <= c0) {
1326 UNSUPPORTED("c2sevxb1gtyc2olq8akmvs40u"); // balanceNodes(g, r, v, w);
1327 UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
1328 UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
1329 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1330 UNSUPPORTED("v7vqc9l7ge2bfdwnw11z7rzi"); // return rv;
1331 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
1332
1333 throw new UnsupportedOperationException();
1334 }
1335
1336
1337
1338
1339 //3 bxwzx4m9ejausu58u7abr6fm0
1340 // static int transpose_step(graph_t * g, int r, int reverse)
1341 public static int transpose_step(ST_Agraph_s g, int r, boolean reverse) {
1342 ENTERING("bxwzx4m9ejausu58u7abr6fm0","transpose_step");
1343 try {
1344 int i, c0, c1, rv;
1345 ST_Agnode_s v, w;
1346 rv = 0;
1347 GD_rank(g).get(r).candidate= false;
1348 for (i = 0; i < GD_rank(g).get(r).n - 1; i++) {
1349 v = (ST_Agnode_s) GD_rank(g).get(r).v.get(i);
1350 w = (ST_Agnode_s) GD_rank(g).get(r).v.plus(i + 1).getPtr();
1351 //assert(ND_order(v) < ND_order(w));
1352 if (left2right(g, v, w))
1353 continue;
1354 c0 = c1 = 0;
1355 if (r > 0) {
1356 c0 += in_cross(v, w);
1357 c1 += in_cross(w, v);
1358 }
1359 if (GD_rank(g).get(r + 1).n > 0) {
1360 c0 += out_cross(v, w);
1361 c1 += out_cross(w, v);
1362 }
1363 if ((c1 < c0) || ((c0 > 0) && reverse && (c1 == c0))) {
1364 exchange(v, w);
1365 rv += (c0 - c1);
1366 GD_rank(Z.z().Root).get(r).valid= 0;
1367 GD_rank(g).get(r).candidate= NOT(false);
1368 if (r > GD_minrank(g)) {
1369 GD_rank(Z.z().Root).plus(r - 1).getPtr().valid= 0;
1370 GD_rank(g).get(r - 1).candidate= NOT(false);
1371 }
1372 if (r < GD_maxrank(g)) {
1373 GD_rank(Z.z().Root).plus(r + 1).getPtr().valid= 0;
1374 GD_rank(g).get(r + 1).candidate= NOT(false);
1375 }
1376 }
1377 }
1378 return rv;
1379 } finally {
1380 LEAVING("bxwzx4m9ejausu58u7abr6fm0","transpose_step");
1381 }
1382 }
1383
1384
1385
1386
1387 //3 2i22bxgg5y7v5c5d40k5zppky
1388 // static void transpose(graph_t * g, int reverse)
1389 public static void transpose(ST_Agraph_s g, boolean reverse) {
1390 ENTERING("2i22bxgg5y7v5c5d40k5zppky","transpose");
1391 try {
1392 int r, delta;
1393 for (r = GD_minrank(g); r <= GD_maxrank(g); r++)
1394 GD_rank(g).get(r).candidate= NOT(false);
1395 do {
1396 delta = 0;
1397 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
1398 if (GD_rank(g).get(r).candidate) {
1399 delta += transpose_step(g, r, reverse);
1400 }
1401 }
1402 /*} while (delta > ncross(g)*(1.0 - Convergence)); */
1403 } while (delta >= 1);
1404 } finally {
1405 LEAVING("2i22bxgg5y7v5c5d40k5zppky","transpose");
1406 }
1407 }
1408
1409
1410
1411
1412 //3 7lrk2rxqnwwdau8cx85oqkpmv
1413 // static int mincross(graph_t * g, int startpass, int endpass, int doBalance)
1414 public static int mincross_(ST_Agraph_s g, int startpass, int endpass, boolean doBalance) {
1415 ENTERING("7lrk2rxqnwwdau8cx85oqkpmv","mincross");
1416 try {
1417 int maxthispass=0, iter, trying, pass;
1418 int cur_cross, best_cross;
1419 if (startpass > 1) {
1420 cur_cross = best_cross = ncross(g);
1421 save_best(g);
1422 } else
1423 cur_cross = best_cross = INT_MAX;
1424 for (pass = startpass; pass <= endpass; pass++) {
1425 if (pass <= 1) {
1426 maxthispass = MIN(4, Z.z().MaxIter);
1427 if (EQ(g, dot_root(g)))
1428 build_ranks(g, pass);
1429 if (pass == 0)
1430 flat_breakcycles(g);
1431 flat_reorder(g);
1432 if ((cur_cross = ncross(g)) <= best_cross) {
1433 save_best(g);
1434 best_cross = cur_cross;
1435 }
1436 trying = 0;
1437 } else {
1438 maxthispass = Z.z().MaxIter;
1439 if (cur_cross > best_cross)
1440 restore_best(g);
1441 cur_cross = best_cross;
1442 }
1443 trying = 0;
1444 for (iter = 0; iter < maxthispass; iter++) {
1445 /*if (Verbose)
1446 fprintf(stderr,
1447 "mincross: pass %d iter %d trying %d cur_cross %d best_cross %d\n",
1448 pass, iter, trying, cur_cross, best_cross);*/
1449 if (trying++ >= Z.z().MinQuit)
1450 break;
1451 if (cur_cross == 0)
1452 break;
1453 mincross_step(g, iter);
1454 if ((cur_cross = ncross(g)) <= best_cross) {
1455 save_best(g);
1456 if (cur_cross < Z.z().Convergence * best_cross)
1457 trying = 0;
1458 best_cross = cur_cross;
1459 }
1460 }
1461 if (cur_cross == 0)
1462 break;
1463 }
1464 if (cur_cross > best_cross)
1465 restore_best(g);
1466 if (best_cross > 0) {
1467 transpose(g, false);
1468 best_cross = ncross(g);
1469 }
1470 if (doBalance) {
1471 for (iter = 0; iter < maxthispass; iter++)
1472 balance(g);
1473 }
1474 return best_cross;
1475 } finally {
1476 LEAVING("7lrk2rxqnwwdau8cx85oqkpmv","mincross");
1477 }
1478 }
1479
1480
1481
1482
1483 //3 520049zkz9mafaeklgvm6s8e5
1484 // static void restore_best(graph_t * g)
1485 public static void restore_best(ST_Agraph_s g) {
1486 ENTERING("520049zkz9mafaeklgvm6s8e5","restore_best");
1487 try {
1488 ST_Agnode_s n;
1489 int r;
1490 for (n = GD_nlist(g); n!=null; n = ND_next(n))
1491 ND_order(n, (int)ND_coord(n).x);
1492 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
1493 GD_rank(Z.z().Root).get(r).valid= 0;
1494 qsort(GD_rank(g).get(r).v,
1495 GD_rank(g).get(r).n,
1496 function(mincross__c.class, "nodeposcmpf"));
1497 }
1498 } finally {
1499 LEAVING("520049zkz9mafaeklgvm6s8e5","restore_best");
1500 }
1501 }
1502
1503
1504
1505
1506 //3 8uyqc48j0oul206l3np85wj9p
1507 // static void save_best(graph_t * g)
1508 public static void save_best(ST_Agraph_s g) {
1509 ENTERING("8uyqc48j0oul206l3np85wj9p","save_best");
1510 try {
1511 ST_Agnode_s n;
1512 for (n = GD_nlist(g); n!=null; n = ND_next(n))
1513 (ND_coord(n)).x = ND_order(n);
1514 } finally {
1515 LEAVING("8uyqc48j0oul206l3np85wj9p","save_best");
1516 }
1517 }
1518
1519
1520
1521
1522 //3 6d08fwi4dsk6ikk5d0gy6rq2h
1523 // static void merge_components(graph_t * g)
1524 public static void merge_components(ST_Agraph_s g) {
1525 ENTERING("6d08fwi4dsk6ikk5d0gy6rq2h","merge_components");
1526 try {
1527 int c;
1528 ST_Agnode_s u, v;
1529 if (GD_comp(g).size <= 1)
1530 return;
1531 u = null;
1532 for (c = 0; c < GD_comp(g).size; c++) {
1533 v = (ST_Agnode_s) GD_comp(g).getFromList(c);
1534 if (u!=null)
1535 ND_next(u, v);
1536 ND_prev(v, u);
1537 while (ND_next(v)!=null) {
1538 v = ND_next(v);
1539 }
1540 u = v;
1541 }
1542 GD_comp(g).size = 1;
1543 GD_nlist(g, GD_comp(g).getFromList(0));
1544 GD_minrank(g, Z.z().GlobalMinRank);
1545 GD_maxrank(g, Z.z().GlobalMaxRank);
1546 } finally {
1547 LEAVING("6d08fwi4dsk6ikk5d0gy6rq2h","merge_components");
1548 }
1549 }
1550
1551
1552
1553
1554 //3 91vebcdl3q3y0uyxef0iw71n9
1555 // static void merge2(graph_t * g)
1556 public static void merge2(ST_Agraph_s g) {
1557 ENTERING("91vebcdl3q3y0uyxef0iw71n9","merge2");
1558 try {
1559 int i, r;
1560 ST_Agnode_s v;
1561 /* merge the components and rank limits */
1562 merge_components(g);
1563 /* install complete ranks */
1564 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
1565 GD_rank(g).plus(r).setInt("n", GD_rank(g).get(r).an);
1566 GD_rank(g).plus(r).setPtr("v", GD_rank(g).get(r).av);
1567 for (i = 0; i < GD_rank(g).get(r).n; i++) {
1568 v = (ST_Agnode_s) GD_rank(g).get(r).v.get(i);
1569 if (v == null) {
1570 /*if (Verbose)
1571 fprintf(stderr,
1572 "merge2: graph %s, rank %d has only %d < %d nodes\n",
1573 agnameof(g), r, i, GD_rank(g)[r].n);*/
1574 GD_rank(g).plus(r).setInt("n", i);
1575 break;
1576 }
1577 ND_order(v, i);
1578 }
1579 }
1580 } finally {
1581 LEAVING("91vebcdl3q3y0uyxef0iw71n9","merge2");
1582 }
1583 }
1584
1585
1586
1587
1588 //3 3cwiyyk1d1jkoo9iqwb5bge4x
1589 // static void cleanup2(graph_t * g, int nc)
1590 public static void cleanup2(ST_Agraph_s g, int nc) {
1591 ENTERING("3cwiyyk1d1jkoo9iqwb5bge4x","cleanup2");
1592 try {
1593 int i, j, r, c;
1594 ST_Agnode_s v;
1595 ST_Agedge_s e;
1596 if (Z.z().TI_list!=null) {
1597 Memory.free(Z.z().TI_list);
1598 Z.z().TI_list = null;
1599 }
1600 if (Z.z().TE_list!=null) {
1601 Memory.free(Z.z().TE_list);
1602 Z.z().TE_list = null;
1603 }
1604 /* fix vlists of clusters */
1605 for (c = 1; c <= GD_n_cluster(g); c++)
1606 rec_reset_vlists((ST_Agraph_s) GD_clust(g).get(c).getPtr());
1607 /* remove node temporary edges for ordering nodes */
1608 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
1609 for (i = 0; i < GD_rank(g).get(r).n; i++) {
1610 v = (ST_Agnode_s) GD_rank(g).get(r).v.get(i);
1611 ND_order(v, i);
1612 if (ND_flat_out(v).listNotNull()) {
1613 for (j = 0; (e = (ST_Agedge_s) ND_flat_out(v).getFromList(j))!=null; j++)
1614 if (ED_edge_type(e) == 4) {
1615 delete_flat_edge(e);
1616 Memory.free(e.base.data);
1617 Memory.free(e);
1618 j--;
1619 }
1620 }
1621 }
1622 free_matrix((ST_adjmatrix_t) GD_rank(g).get(r).flat);
1623 }
1624 /*if (Verbose)
1625 fprintf(stderr, "mincross %s: %d crossings, %.2f secs.\n",
1626 agnameof(g), nc, elapsed_sec());*/
1627 } finally {
1628 LEAVING("3cwiyyk1d1jkoo9iqwb5bge4x","cleanup2");
1629 }
1630 }
1631
1632
1633
1634
1635 //3 arax68kzcf86dr2xu0gp962gq
1636 // static node_t *neighbor(node_t * v, int dir)
1637 public static ST_Agnode_s neighbor(ST_Agnode_s v, int dir) {
1638 ENTERING("arax68kzcf86dr2xu0gp962gq","neighbor");
1639 try {
1640 ST_Agnode_s rv;
1641 rv = null;
1642 assert(v!=null);
1643 if (dir < 0) {
1644 if (ND_order(v) > 0)
1645 rv = (ST_Agnode_s) GD_rank(Z.z().Root).plus(ND_rank(v)).getPtr().v.plus(ND_order(v) - 1).getPtr();
1646 } else
1647 rv = (ST_Agnode_s) GD_rank(Z.z().Root).plus(ND_rank(v)).getPtr().v.plus(ND_order(v) + 1).getPtr();
1648 assert((rv == null) || (ND_order(rv)-ND_order(v))*dir > 0);
1649 return rv;
1650 } finally {
1651 LEAVING("arax68kzcf86dr2xu0gp962gq","neighbor");
1652 }
1653 }
1654
1655
1656
1657
1658 //3 1waqm8z71hi389dt1wqh0bmhr
1659 // static int is_a_normal_node_of(graph_t * g, node_t * v)
1660 public static boolean is_a_normal_node_of(ST_Agraph_s g, ST_Agnode_s v) {
1661 ENTERING("1waqm8z71hi389dt1wqh0bmhr","is_a_normal_node_of");
1662 try {
1663 return ((ND_node_type(v) == 0) && agcontains(g, v));
1664 } finally {
1665 LEAVING("1waqm8z71hi389dt1wqh0bmhr","is_a_normal_node_of");
1666 }
1667 }
1668
1669
1670
1671
1672 //3 9f8atyi1unmleplge3rijdt4s
1673 // static int is_a_vnode_of_an_edge_of(graph_t * g, node_t * v)
1674 public static boolean is_a_vnode_of_an_edge_of(ST_Agraph_s g, ST_Agnode_s v) {
1675 ENTERING("9f8atyi1unmleplge3rijdt4s","is_a_vnode_of_an_edge_of");
1676 try {
1677 if ((ND_node_type(v) == 1)
1678 && (ND_in(v).size == 1) && (ND_out(v).size == 1)) {
1679 ST_Agedge_s e = (ST_Agedge_s) ND_out(v).getFromList(0);
1680 while (ED_edge_type(e) != 0)
1681 e = ED_to_orig(e);
1682 if (agcontains(g, e))
1683 return NOT(false);
1684 }
1685 return false;
1686 } finally {
1687 LEAVING("9f8atyi1unmleplge3rijdt4s","is_a_vnode_of_an_edge_of");
1688 }
1689 }
1690
1691
1692
1693
1694 //3 eo7ulc8vwmoaig0j479yapve2
1695 // static int inside_cluster(graph_t * g, node_t * v)
1696 public static boolean inside_cluster(ST_Agraph_s g, ST_Agnode_s v) {
1697 ENTERING("eo7ulc8vwmoaig0j479yapve2","inside_cluster");
1698 try {
1699 return (is_a_normal_node_of(g, v) | is_a_vnode_of_an_edge_of(g, v));
1700 } finally {
1701 LEAVING("eo7ulc8vwmoaig0j479yapve2","inside_cluster");
1702 }
1703 }
1704
1705
1706
1707
1708 //3 8xkmkt4r6gfqj8gk0mokszoz0
1709 // static node_t *furthestnode(graph_t * g, node_t * v, int dir)
1710 public static ST_Agnode_s furthestnode(ST_Agraph_s g, ST_Agnode_s v, int dir) {
1711 ENTERING("8xkmkt4r6gfqj8gk0mokszoz0","furthestnode");
1712 try {
1713 ST_Agnode_s u, rv;
1714 rv = u = v;
1715 while ((u = neighbor(u, dir))!=null) {
1716 if (is_a_normal_node_of(g, u))
1717 rv = u;
1718 else if (is_a_vnode_of_an_edge_of(g, u))
1719 rv = u;
1720 }
1721 return rv;
1722 } finally {
1723 LEAVING("8xkmkt4r6gfqj8gk0mokszoz0","furthestnode");
1724 }
1725 }
1726
1727
1728
1729
1730 //3 bwmu2hkwud40601oq5vgo2f1h
1731 // void save_vlist(graph_t * g)
1732 public static void save_vlist(ST_Agraph_s g) {
1733 ENTERING("bwmu2hkwud40601oq5vgo2f1h","save_vlist");
1734 try {
1735 int r;
1736 if (GD_rankleader(g)!=null)
1737 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
1738 GD_rankleader(g).plus(r).setPtr(GD_rank(g).get(r).v.get(0));
1739 }
1740 } finally {
1741 LEAVING("bwmu2hkwud40601oq5vgo2f1h","save_vlist");
1742 }
1743 }
1744
1745
1746
1747
1748 //3 hwdxg97sefkuyd25x2q4pgzg
1749 // void rec_save_vlists(graph_t * g)
1750 public static void rec_save_vlists(ST_Agraph_s g) {
1751 ENTERING("hwdxg97sefkuyd25x2q4pgzg","rec_save_vlists");
1752 try {
1753 int c;
1754 save_vlist(g);
1755 for (c = 1; c <= GD_n_cluster(g); c++)
1756 rec_save_vlists((ST_Agraph_s) GD_clust(g).get(c).getPtr());
1757 } finally {
1758 LEAVING("hwdxg97sefkuyd25x2q4pgzg","rec_save_vlists");
1759 }
1760 }
1761
1762
1763
1764
1765 //3 f3b4wat4uxn5oil720i5mwq4v
1766 // void rec_reset_vlists(graph_t * g)
1767 public static void rec_reset_vlists(ST_Agraph_s g) {
1768 ENTERING("f3b4wat4uxn5oil720i5mwq4v","rec_reset_vlists");
1769 try {
1770 int r, c;
1771 ST_Agnode_s u, v, w;
1772 /* fix vlists of sub-clusters */
1773 for (c = 1; c <= GD_n_cluster(g); c++)
1774 rec_reset_vlists((ST_Agraph_s) GD_clust(g).get(c).getPtr());
1775 if (GD_rankleader(g)!=null)
1776 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
1777 v = (ST_Agnode_s) GD_rankleader(g).get(r);
1778 u = furthestnode(g, v, -1);
1779 w = furthestnode(g, v, 1);
1780 GD_rankleader(g).plus(r).setPtr(u);
1781 GD_rank(g).plus(r).setPtr("v", GD_rank(dot_root(g)).get(r).v.plus(ND_order(u)));
1782 GD_rank(g).plus(r).setInt("n", ND_order(w) - ND_order(u) + 1);
1783 }
1784 } finally {
1785 LEAVING("f3b4wat4uxn5oil720i5mwq4v","rec_reset_vlists");
1786 }
1787 }
1788
1789
1790
1791
1792 //3 pv0rbbdopo4hmkbl5916qys1
1793 // static Agraph_t* realFillRanks (Agraph_t* g, int rnks[], int rnks_sz, Agraph_t* sg)
1794 public static ST_Agraph_s realFillRanks(ST_Agraph_s g, __ptr__ rnks, int rnks_sz, ST_Agraph_s sg) {
1795 ENTERING("pv0rbbdopo4hmkbl5916qys1","realFillRanks");
1796 try {
1797 UNSUPPORTED("2o2sf6xi2aumo5k0vglp4ik2y"); // static Agraph_t*
1798 UNSUPPORTED("3pmsfb0uhqmy5u141c932dtn1"); // realFillRanks (Agraph_t* g, int rnks[], int rnks_sz, Agraph_t* sg)
1799 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
1800 UNSUPPORTED("apiu3v3f9zs9yrq8e25nd2rti"); // int i, c;
1801 UNSUPPORTED("6yramhpyls8c6kexupyqip8oq"); // Agedge_t* e;
1802 UNSUPPORTED("ci2zh69w6nhi0q816i1ixuy9k"); // Agnode_t* n;
1803 UNSUPPORTED("7z5fb6iyowsosn1hiz7opeoc6"); // for (c = 1; c <= GD_n_cluster(g); c++)
1804 UNSUPPORTED("wqxqmv4he79njsw6r7sludv"); // sg = realFillRanks (GD_clust(g)[c], rnks, rnks_sz, sg);
1805 UNSUPPORTED("8htor72y55gsejjdeh0e8gdrs"); // if (dot_root(g) == g)
1806 UNSUPPORTED("bjae04ek2s3o50399zti5a1jh"); // return sg;
1807 UNSUPPORTED("bqfhaopbxlwv8h4zfae1lhx6s"); // memset (rnks, 0, sizeof(int)*rnks_sz);
1808 UNSUPPORTED("7wq24g054kmx3aw25vk5ksj4"); // for (n = agfstnode(g); n; n = agnxtnode(g,n)) {
1809 UNSUPPORTED("do7v5atqor4gnpwgo18ibgjha"); // rnks[ND_rank(n)] = 1;
1810 UNSUPPORTED("9fo44dng5uojukw2kj0z8vvdu"); // for (e = agfstout(g,n); e; e = agnxtout(g,e)) {
1811 UNSUPPORTED("emlgvc6yzuboae72y6vxpn8z7"); // for (i = ND_rank(n)+1; i <= ND_rank(aghead(e)); i++)
1812 UNSUPPORTED("d3fd9x50ix980jjw3old2jrcr"); // rnks[i] = 1;
1813 UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
1814 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1815 UNSUPPORTED("7gfo0rr0un3w2026kt6ipknty"); // for (i = GD_minrank(g); i <= GD_maxrank(g); i++) {
1816 UNSUPPORTED("6mjvdb94lywg8d7ui6873f18p"); // if (rnks[i] == 0) {
1817 UNSUPPORTED("8g0zxrf8w2zly4wln02j3lbnb"); // if (!sg) {
1818 UNSUPPORTED("eqx93butvb7swnxbz9j29winp"); // sg = agsubg (dot_root(g), "_new_rank", 1);
1819 UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
1820 UNSUPPORTED("9h7suegjozc071a939rh9apw1"); // n = agnode (sg, NULL, 1);
1821 UNSUPPORTED("8kclviftszfxkowsmlqq31u8"); // agbindrec(n, "Agnodeinfo_t", sizeof(Agnodeinfo_t), NOT(0));
1822 UNSUPPORTED("8wiry1vcdwy6bzdp98nmxss7c"); // ND_rank(n) = i;
1823 UNSUPPORTED("dy16sxtk3jj6127wavfcdx4yw"); // ND_lw(n) = ND_rw(n) = 0.5;
1824 UNSUPPORTED("6jr3li9af4sp0uxnpnoe8dqh8"); // ND_ht(n) = 1;
1825 UNSUPPORTED("c47fetnb62mx46qzuk9ag3qmu"); // ND_UF_size(n) = 1;
1826 UNSUPPORTED("899cyghezv8oxs0iomu58zncj"); // alloc_elist(4, ND_in(n));
1827 UNSUPPORTED("btfqtg58rqwdh7o4cc0gbaaai"); // alloc_elist(4, ND_out(n));
1828 UNSUPPORTED("9zap4z819hsiogrgmekh15f00"); // agsubnode (g, n, 1);
1829 UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
1830 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
1831 UNSUPPORTED("1jw141gg4omv8r72xcbl5ln0o"); // return sg;
1832 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
1833
1834 throw new UnsupportedOperationException();
1835 } finally {
1836 LEAVING("pv0rbbdopo4hmkbl5916qys1","realFillRanks");
1837 }
1838 }
1839
1840
1841
1842
1843 //3 1qy9bupreg1pax62owznr98k
1844 // static void fillRanks (Agraph_t* g)
1845 public static void fillRanks(ST_Agraph_s g) {
1846 ENTERING("1qy9bupreg1pax62owznr98k","fillRanks");
1847 try {
1848 ST_Agraph_s sg;
1849 int rnks_sz = GD_maxrank(g) + 2;
1850 __ptr__ rnks = zmalloc(size_t_array_of_integer(rnks_sz));
1851 sg = realFillRanks (g, rnks, rnks_sz, null);
1852 Memory.free (rnks);
1853 } finally {
1854 LEAVING("1qy9bupreg1pax62owznr98k","fillRanks");
1855 }
1856 }
1857
1858
1859
1860
1861 //3 7fy4chyk12o7bgp1rv3h27yl3
1862 // static void init_mincross(graph_t * g)
1863 public static void init_mincross(ST_Agraph_s g) {
1864 ENTERING("7fy4chyk12o7bgp1rv3h27yl3","init_mincross");
1865 try {
1866 int size;
1867 //if (Verbose)
1868 //start_timer();
1869 Z.z().ReMincross = false;
1870 Z.z().Root = g;
1871 /* alloc +1 for the null terminator usage in do_ordering() */
1872 /* also, the +1 avoids attempts to alloc 0 sizes, something
1873 that efence complains about */
1874 size = agnedges(dot_root(g)) + 1;
1875 Z.z().TE_list = new ST_Agedge_s.ArrayOfStar(size);
1876 Z.z().TI_list = zmalloc(size_t_array_of_integer(size));
1877 mincross_options(g);
1878 if ((GD_flags(g) & (1 << 4))!=0)
1879 fillRanks (g);
1880 class2(g);
1881 decompose(g, 1);
1882 allocate_ranks(g);
1883 ordered_edges(g);
1884 Z.z().GlobalMinRank = GD_minrank(g);
1885 Z.z().GlobalMaxRank = GD_maxrank(g);
1886 } finally {
1887 LEAVING("7fy4chyk12o7bgp1rv3h27yl3","init_mincross");
1888 }
1889 }
1890
1891
1892
1893
1894 //3 6fprrp93vmz0jn3l4ro0iropp
1895 // void flat_rev(Agraph_t * g, Agedge_t * e)
1896 public static void flat_rev(ST_Agraph_s g, ST_Agedge_s e) {
1897 ENTERING("6fprrp93vmz0jn3l4ro0iropp","flat_rev");
1898 try {
1899 int j;
1900 ST_Agedge_s rev;
1901 if (ND_flat_out(aghead(e)).listNotNull()==false)
1902 // if (N(ND_flat_out(aghead(e)).list))
1903 rev = null;
1904 else
1905 for (j = 0; (rev = (ST_Agedge_s) ND_flat_out(aghead(e)).getFromList(j))!=null; j++)
1906 if (EQ(aghead(rev), agtail(e)))
1907 break;
1908 if (rev!=null) {
1909 merge_oneway(e, rev);
1910 if (ED_to_virt(e) == null)
1911 ED_to_virt(e, rev);
1912 if ((ED_edge_type(rev) == 4)
1913 && (ED_to_orig(rev) == null))
1914 ED_to_orig(rev, e);
1915 elist_append(e, ND_other(agtail(e)));
1916 } else {
1917 rev = new_virtual_edge(aghead(e), agtail(e), e);
1918 if (ED_edge_type(e) == 4)
1919 ED_edge_type(rev, 4);
1920 else
1921 ED_edge_type(rev, 3);
1922 ED_label(rev, ED_label(e));
1923 flat_edge(g, rev);
1924 }
1925 } finally {
1926 LEAVING("6fprrp93vmz0jn3l4ro0iropp","flat_rev");
1927 }
1928 }
1929
1930
1931
1932
1933 //3 63ol0ch6cgln1nvl5oiz6n1v0
1934 // static void flat_search(graph_t * g, node_t * v)
1935 public static void flat_search(ST_Agraph_s g, ST_Agnode_s v) {
1936 ENTERING("63ol0ch6cgln1nvl5oiz6n1v0","flat_search");
1937 try {
1938 int i;
1939 boolean hascl;
1940 ST_Agedge_s e;
1941 ST_adjmatrix_t M = (ST_adjmatrix_t) GD_rank(g).get(ND_rank(v)).flat;
1942 ND_mark(v, NOT(false));
1943 ND_onstack(v, NOT(false));
1944 hascl = (GD_n_cluster(dot_root(g)) > 0);
1945 if (ND_flat_out(v).listNotNull())
1946 for (i = 0; (e = (ST_Agedge_s) ND_flat_out(v).getFromList(i))!=null; i++) {
1947 if (hascl
1948 && NOT(agcontains(g, agtail(e)) && agcontains(g, aghead(e))))
1949 continue;
1950 if (ED_weight(e) == 0)
1951 continue;
1952 if (ND_onstack(aghead(e)) == NOT(false)) {
1953 assert(ND_low(aghead(e)) < M.nrows);
1954 assert(ND_low(agtail(e)) < M.ncols);
1955 M.data[ND_low(aghead(e))][ND_low(agtail(e))]=1;
1956 delete_flat_edge(e);
1957 i--;
1958 if (ED_edge_type(e) == 4)
1959 continue;
1960 flat_rev(g, e);
1961 } else {
1962 assert(ND_low(aghead(e)) < M.nrows);
1963 assert(ND_low(agtail(e)) < M.ncols);
1964 M.data[ND_low(agtail(e))][ND_low(aghead(e))]=1;
1965 if (ND_mark(aghead(e)) == 0)
1966 flat_search(g, aghead(e));
1967 }
1968 }
1969 ND_onstack(v, 0);
1970 } finally {
1971 LEAVING("63ol0ch6cgln1nvl5oiz6n1v0","flat_search");
1972 }
1973 }
1974
1975
1976
1977
1978 //3 3v5h7z4vqivibvpt913lg8at0
1979 // static void flat_breakcycles(graph_t * g)
1980 public static void flat_breakcycles(ST_Agraph_s g) {
1981 ENTERING("3v5h7z4vqivibvpt913lg8at0","flat_breakcycles");
1982 try {
1983 int i, r, flat;
1984 ST_Agnode_s v;
1985 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
1986 flat = 0;
1987 for (i = 0; i < GD_rank(g).get(r).n; i++) {
1988 v = (ST_Agnode_s) GD_rank(g).get(r).v.get(i);
1989 ND_mark(v, 0);
1990 ND_onstack(v, 0);
1991 ND_low(v, i);
1992 if ((ND_flat_out(v).size > 0) && (flat == 0)) {
1993 GD_rank(g).plus(r).setPtr("flat",
1994 new_matrix(GD_rank(g).get(r).n, GD_rank(g).get(r).n));
1995 flat = 1;
1996 }
1997 }
1998 if (flat!=0) {
1999 for (i = 0; i < GD_rank(g).get(r).n; i++) {
2000 v = (ST_Agnode_s) GD_rank(g).get(r).v.get(i);
2001 if (ND_mark(v) == 0)
2002 flat_search(g, v);
2003 }
2004 }
2005 }
2006 } finally {
2007 LEAVING("3v5h7z4vqivibvpt913lg8at0","flat_breakcycles");
2008 }
2009 }
2010
2011
2012
2013
2014 //3 d5vb6jiw8mhkaa8gjwn4eqfyn
2015 // void allocate_ranks(graph_t * g)
2016 public static void allocate_ranks(ST_Agraph_s g) {
2017 ENTERING("d5vb6jiw8mhkaa8gjwn4eqfyn","allocate_ranks");
2018 try {
2019 // REVIEW 17/01/2016
2020 int r, low, high;
2021 __ptr__ cn;
2022 ST_Agnode_s n;
2023 ST_Agedge_s e;
2024 cn = zmalloc(size_t_array_of_integer(GD_maxrank(g) + 2));
2025 /* must be 0 based, not GD_minrank */
2026 for (n = agfstnode(g); n!=null; n = agnxtnode(g, n)) {
2027 cn.plus(ND_rank(n)).setInt(1+cn.plus(ND_rank(n)).getInt());
2028 for (e = agfstout(g, n); e!=null; e = agnxtout(g, e)) {
2029 low = ND_rank(agtail(e));
2030 high = ND_rank(aghead(e));
2031 if (low > high) {
2032 int t = low;
2033 low = high;
2034 high = t;
2035 }
2036 for (r = low + 1; r < high; r++)
2037 cn.plus(r).setInt(1+cn.plus(r).getInt());
2038 }
2039 }
2040 GD_rank(g, new ST_rank_t.Array2(GD_maxrank(g) + 2));
2041 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
2042 GD_rank(g).plus(r).setInt("n", cn.plus(r).getInt());
2043 GD_rank(g).plus(r).setInt("an", cn.plus(r).getInt());
2044 ST_Agnode_s.ArrayOfStar tmp = new ST_Agnode_s.ArrayOfStar(cn.plus(r).getInt() + 1);
2045 GD_rank(g).plus(r).setPtr("v", tmp);
2046 GD_rank(g).plus(r).setPtr("av", tmp);
2047 }
2048 Memory.free(cn);
2049 } finally {
2050 LEAVING("d5vb6jiw8mhkaa8gjwn4eqfyn","allocate_ranks");
2051 }
2052 }
2053
2054
2055
2056
2057 //3 3lxoqxhiri9fgt20zc5jz3aa5
2058 // void install_in_rank(graph_t * g, node_t * n)
2059 public static void install_in_rank(ST_Agraph_s g, ST_Agnode_s n) {
2060 ENTERING("3lxoqxhiri9fgt20zc5jz3aa5","install_in_rank");
2061 try {
2062 int i, r;
2063 r = ND_rank(n);
2064 i = GD_rank(g).get(r).n;
2065 if (GD_rank(g).get(r).an <= 0) {
2066 UNSUPPORTED("8qk1xhvvb994zhv9aq10k4v12"); // agerr(AGERR, "install_in_rank, line %d: %s %s rank %d i = %d an = 0\n",
2067 UNSUPPORTED("53h8d82ax23hys2k21hjswp72"); // 1034, agnameof(g), agnameof(n), r, i);
2068 return;
2069 }
2070 GD_rank(g).get(r).v.plus(i).setPtr(n);
2071 ND_order(n, i);
2072 GD_rank(g).plus(r).setInt("n", 1+GD_rank(g).get(r).n);
2073 // assert(GD_rank(g)[r].n <= GD_rank(g)[r].an);
2074 if (ND_order(n) > GD_rank(Z.z().Root).get(r).an) {
2075 UNSUPPORTED("399szcw1txekt1xssyw7s2x07"); // agerr(AGERR, "install_in_rank, line %d: ND_order(%s) [%d] > GD_rank(Root)[%d].an [%d]\n",
2076 UNSUPPORTED("9puojrmsk6vb1qc0jtr8ge4g8"); // 1052, agnameof(n), ND_order(n), r, GD_rank(Root)[r].an);
2077 return;
2078 }
2079 if ((r < GD_minrank(g)) || (r > GD_maxrank(g))) {
2080 UNSUPPORTED("7o1thnqda767wqpe2lh9mj03t"); // agerr(AGERR, "install_in_rank, line %d: rank %d not in rank range [%d,%d]\n",
2081 UNSUPPORTED("d2ugluzf7bmj7osicgitgy3sr"); // 1057, r, GD_minrank(g), GD_maxrank(g));
2082 return;
2083 }
2084 if (GD_rank(g).get(r).v.plus(ND_order(n)).comparePointer(
2085 GD_rank(g).get(r).av.plus(GD_rank(Z.z().Root).get(r).an))>0) {
2086 UNSUPPORTED("3eb32nc5czs5auwzz5p5mtl04"); // agerr(AGERR, "install_in_rank, line %d: GD_rank(g)[%d].v + ND_order(%s) [%d] > GD_rank(g)[%d].av + GD_rank(Root)[%d].an [%d]\n",
2087 UNSUPPORTED("3qe3qpw5h6vse39xs1ca9sjmo"); // 1062, r, agnameof(n),GD_rank(g)[r].v + ND_order(n), r, r, GD_rank(g)[r].av+GD_rank(Root)[r].an);
2088 return;
2089 }
2090 } finally {
2091 LEAVING("3lxoqxhiri9fgt20zc5jz3aa5","install_in_rank");
2092 }
2093 }
2094
2095
2096
2097
2098 //3 7t49bz6lfcbd9v63ds2x3518z
2099 // void build_ranks(graph_t * g, int pass)
2100 public static void build_ranks(ST_Agraph_s g, int pass) {
2101 ENTERING("7t49bz6lfcbd9v63ds2x3518z","build_ranks");
2102 try {
2103 int i, j;
2104 ST_Agnode_s n, n0 = null;
2105 List<ST_Agedge_s> otheredges;
2106 ST_nodequeue q;
2107 q = new_queue(GD_n_nodes(g));
2108 for (n = GD_nlist(g); n!=null; n = ND_next(n))
2109 ND_mark(n, 0);
2110 for (i = GD_minrank(g); i <= GD_maxrank(g); i++)
2111 GD_rank(g).plus(i).setInt("n", 0);
2112 for (n = GD_nlist(g); n!=null; n = ND_next(n)) {
2113 otheredges = ((pass == 0) ? ND_in(n).list : ND_out(n).list);
2114 if (otheredges.get(0)!= null)
2115 continue;
2116 if ((ND_mark(n)) == 0) {
2117 ND_mark(n, 1);
2118 enqueue(q, n);
2119 while ((n0 = dequeue(q))!=null) {
2120 if (ND_ranktype(n0) != 7) {
2121 install_in_rank(g, n0);
2122 enqueue_neighbors(q, n0, pass);
2123 } else {
2124 install_cluster(g, n0, pass, q);
2125 }
2126 }
2127 }
2128 }
2129 if (dequeue(q)!=null)
2130 UNSUPPORTED("1b3hbd5artrq77i58q2o9kgz3"); // agerr(AGERR, "surprise\n");
2131 for (i = GD_minrank(g); i <= GD_maxrank(g); i++) {
2132 GD_rank(Z.z().Root).plus(i).setInt("valid", 0);
2133 if (GD_flip(g)!=0 && (GD_rank(g).get(i).n > 0)) {
2134 int nn, ndiv2;
2135 ST_Agnode_s.ArrayOfStar vlist = GD_rank(g).get(i).v;
2136 nn = GD_rank(g).get(i).n - 1;
2137 ndiv2 = nn / 2;
2138 for (j = 0; j <= ndiv2; j++)
2139 exchange((ST_Agnode_s)vlist.get(j), (ST_Agnode_s)vlist.plus(nn - j).getPtr());
2140 }
2141 }
2142 if (EQ(g, dot_root(g)) && ncross(g) > 0)
2143 transpose(g, false);
2144 free_queue(q);
2145 } finally {
2146 LEAVING("7t49bz6lfcbd9v63ds2x3518z","build_ranks");
2147 }
2148 }
2149
2150
2151
2152
2153 //3 bmjlneqxex6a9silzkkidkx6s
2154 // void enqueue_neighbors(nodequeue * q, node_t * n0, int pass)
2155 public static void enqueue_neighbors(ST_nodequeue q, ST_Agnode_s n0, int pass) {
2156 ENTERING("bmjlneqxex6a9silzkkidkx6s","enqueue_neighbors");
2157 try {
2158 int i;
2159 ST_Agedge_s e;
2160 if (pass == 0) {
2161 for (i = 0; i < ND_out(n0).size; i++) {
2162 e = (ST_Agedge_s) ND_out(n0).getFromList(i);
2163 if (((ND_mark(aghead(e)))) == 0) {
2164 ND_mark(aghead(e), 1);
2165 enqueue(q, aghead(e));
2166 }
2167 }
2168 } else {
2169 for (i = 0; i < ND_in(n0).size; i++) {
2170 e = (ST_Agedge_s) ND_in(n0).getFromList(i);
2171 if (((ND_mark(agtail(e)))) == 0) {
2172 ND_mark(agtail(e), 1);
2173 enqueue(q, agtail(e));
2174 }
2175 }
2176 }
2177 } finally {
2178 LEAVING("bmjlneqxex6a9silzkkidkx6s","enqueue_neighbors");
2179 }
2180 }
2181
2182
2183
2184
2185 //3 c8nqj0v20api63pikohsbx92u
2186 // static int constraining_flat_edge(Agraph_t *g, Agnode_t *v, Agedge_t *e)
2187 public static boolean constraining_flat_edge(ST_Agraph_s g, ST_Agnode_s v, ST_Agedge_s e) {
2188 ENTERING("c8nqj0v20api63pikohsbx92u","constraining_flat_edge");
2189 try {
2190 if (ED_weight(e) == 0) return false;
2191 if (N(inside_cluster(g,agtail(e)))) return false;
2192 if (N(inside_cluster(g,aghead(e)))) return false;
2193 return NOT(false);
2194 } finally {
2195 LEAVING("c8nqj0v20api63pikohsbx92u","constraining_flat_edge");
2196 }
2197 }
2198
2199
2200
2201
2202 //3 46to0pkk188af2dlkik2ab7e3
2203 // static int postorder(graph_t * g, node_t * v, node_t ** list, int r)
2204 public static int postorder(ST_Agraph_s g, ST_Agnode_s v, __ptr__ list, int r) {
2205 ENTERING("46to0pkk188af2dlkik2ab7e3","postorder");
2206 try {
2207 ST_Agedge_s e;
2208 int i, cnt = 0;
2209 ND_mark(v, NOT(false));
2210 if (ND_flat_out(v).size > 0) {
2211 for (i = 0; (e = (ST_Agedge_s) ND_flat_out(v).getFromList(i))!=null; i++) {
2212 if (N(constraining_flat_edge(g,v,e))) continue;
2213 if ((ND_mark(aghead(e))) == 0)
2214 cnt += postorder(g, aghead(e), list.plus(cnt), r);
2215 }
2216 }
2217 assert(ND_rank(v) == r);
2218 list.plus(cnt++).setPtr(v);
2219 return cnt;
2220 } finally {
2221 LEAVING("46to0pkk188af2dlkik2ab7e3","postorder");
2222 }
2223 }
2224
2225
2226
2227
2228 //3 zuxoswju917kyl08a5f0gtp6
2229 // static void flat_reorder(graph_t * g)
2230 public static void flat_reorder(ST_Agraph_s g) {
2231 ENTERING("zuxoswju917kyl08a5f0gtp6","flat_reorder");
2232 try {
2233 int i, j, r, pos, n_search, local_in_cnt, local_out_cnt, base_order;
2234 ST_Agnode_s v, t;
2235 __ptr__ left, right;
2236 ST_Agnode_s.ArrayOfStar temprank = null;
2237 ST_Agedge_s flat_e, e;
2238 if (GD_has_flat_edges(g) == 0)
2239 return;
2240 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
2241 if (GD_rank(g).get(r).n == 0) continue;
2242 base_order = ND_order(GD_rank(g).get(r).v.get(0));
2243 for (i = 0; i < GD_rank(g).get(r).n; i++)
2244 ND_mark(GD_rank(g).get(r).v.get(i), 0);
2245 temprank = ALLOC_Agnode_s(i + 1, temprank);
2246 pos = 0;
2247 /* construct reverse topological sort order in temprank */
2248 for (i = 0; i < GD_rank(g).get(r).n; i++) {
2249 if (GD_flip(g)!=0) v = (ST_Agnode_s) GD_rank(g).get(r).v.get(i);
2250 else v = (ST_Agnode_s) GD_rank(g).get(r).v.plus(GD_rank(g).get(r).n - i - 1).getPtr();
2251 local_in_cnt = local_out_cnt = 0;
2252 for (j = 0; j < ND_flat_in(v).size; j++) {
2253 flat_e = (ST_Agedge_s) ND_flat_in(v).getFromList(j);
2254 if (constraining_flat_edge(g,v,flat_e)) local_in_cnt++;
2255 }
2256 for (j = 0; j < ND_flat_out(v).size; j++) {
2257 flat_e = (ST_Agedge_s) ND_flat_out(v).getFromList(j);
2258 if (constraining_flat_edge(g,v,flat_e)) local_out_cnt++;
2259 }
2260 if ((local_in_cnt == 0) && (local_out_cnt == 0))
2261 temprank.plus(pos++).setPtr(v);
2262 else {
2263 if (((ND_mark(v)) == 0) && (local_in_cnt == 0)) {
2264 left = temprank.plus(pos);
2265 n_search = postorder(g, v, left, r);
2266 pos += n_search;
2267 }
2268 }
2269 }
2270 if (pos!=0) {
2271 if (GD_flip(g) == 0) {
2272 left = temprank;
2273 right = temprank.plus(pos - 1);
2274 while (left.comparePointer(right) < 0) {
2275 t = (ST_Agnode_s) left.getPtr();
2276 left.setPtr(right.getPtr());
2277 right.setPtr(t);
2278 left = left.plus(1);
2279 right = right.plus(-1);
2280 }
2281 }
2282 for (i = 0; i < GD_rank(g).get(r).n; i++) {
2283 v = (ST_Agnode_s) temprank.get(i);
2284 GD_rank(g).get(r).v.plus(i).setPtr(v);
2285 ND_order(v, i + base_order);
2286 }
2287 /* nonconstraint flat edges must be made LR */
2288 for (i = 0; i < GD_rank(g).get(r).n; i++) {
2289 v = (ST_Agnode_s) GD_rank(g).get(r).v.get(i);
2290 if (ND_flat_out(v).listNotNull()) {
2291 for (j = 0; (e = (ST_Agedge_s) ND_flat_out(v).getFromList(j))!=null; j++) {
2292 if ( ((GD_flip(g) == 0) && (ND_order(aghead(e)) < ND_order(agtail(e)))) ||
2293 ( (GD_flip(g)!=0) && (ND_order(aghead(e)) > ND_order(agtail(e)) ))) {
2294 assert(constraining_flat_edge(g,v,e) == false);
2295 delete_flat_edge(e);
2296 j--;
2297 flat_rev(g, e);
2298 }
2299 }
2300 }
2301 }
2302 /* postprocess to restore intended order */
2303 }
2304 /* else do no harm! */
2305 GD_rank(Z.z().Root).plus(r).setInt("valid", 0);
2306 }
2307 if (temprank!=null)
2308 Memory.free(temprank);
2309 } finally {
2310 LEAVING("zuxoswju917kyl08a5f0gtp6","flat_reorder");
2311 }
2312 }
2313
2314
2315
2316
2317 //3 inv6wazjcnh4xkzzphsdcmg4
2318 // static void reorder(graph_t * g, int r, int reverse, int hasfixed)
2319 public static void reorder(ST_Agraph_s g, int r, boolean reverse, boolean hasfixed) {
2320 ENTERING("inv6wazjcnh4xkzzphsdcmg4","reorder");
2321 try {
2322 boolean changed = false;
2323 int nelt;
2324 boolean muststay, sawclust;
2325 __ptr__ vlist = GD_rank(g).get(r).v;
2326 __ptr__ lp, rp=null, ep = vlist.plus(GD_rank(g).get(r).n);
2327 for (nelt = GD_rank(g).get(r).n - 1; nelt >= 0; nelt--) {
2328 lp = vlist;
2329 while (lp.comparePointer(ep)<0) {
2330 /* find leftmost node that can be compared */
2331 while ((lp.comparePointer(ep) < 0) && (ND_mval(lp.getPtr()) < 0))
2332 lp = lp.plus(1);
2333 if (lp.comparePointer(ep) >= 0)
2334 break;
2335 /* find the node that can be compared */
2336 sawclust = muststay = false;
2337 for (rp = lp.plus(1); rp.comparePointer(ep) < 0; rp=rp.plus(1)) {
2338 if (sawclust && ND_clust(rp.getPtr())!=null)
2339 continue; /* ### */
2340 if (left2right(g, (ST_Agnode_s) lp.getPtr(), (ST_Agnode_s) rp.getPtr())) {
2341 muststay = NOT(false);
2342 break;
2343 }
2344 if (ND_mval(rp.getPtr()) >= 0)
2345 break;
2346 if (ND_clust(rp.getPtr())!=null)
2347 sawclust = NOT(false); /* ### */
2348 }
2349 if (rp.comparePointer(ep) >= 0)
2350 break;
2351 if (muststay == false) {
2352 int p1 = (int) (ND_mval(lp.getPtr()));
2353 int p2 = (int) (ND_mval(rp.getPtr()));
2354 if ((p1 > p2) || ((p1 == p2) && (reverse))) {
2355 exchange((ST_Agnode_s)lp.getPtr(), (ST_Agnode_s)rp.getPtr());
2356 changed=true;
2357 }
2358 }
2359 lp = rp;
2360 }
2361 if ((hasfixed == false) && (reverse == false))
2362 ep = ep.plus(-1);
2363 }
2364 if (changed) {
2365 GD_rank(Z.z().Root).get(r).valid= 0;
2366 if (r > 0)
2367 GD_rank(Z.z().Root).plus(r - 1).getPtr().valid= 0;
2368 }
2369 } finally {
2370 LEAVING("inv6wazjcnh4xkzzphsdcmg4","reorder");
2371 }
2372 }
2373
2374
2375
2376
2377 //3 14t80owwvm7io4ou6czb9ba9
2378 // static void mincross_step(graph_t * g, int pass)
2379 public static void mincross_step(ST_Agraph_s g, int pass) {
2380 ENTERING("14t80owwvm7io4ou6czb9ba9","mincross_step");
2381 try {
2382 int r, other, first, last, dir;
2383 boolean hasfixed, reverse;
2384 if ((pass % 4) < 2)
2385 reverse = NOT(false);
2386 else
2387 reverse = false;
2388 if ((pass % 2)!=0) {
2389 r = GD_maxrank(g) - 1;
2390 dir = -1;
2391 } /* up pass */
2392 else {
2393 r = 1;
2394 dir = 1;
2395 } /* down pass */
2396 if (pass % 2 == 0) { /* down pass */
2397 first = GD_minrank(g) + 1;
2398 if (GD_minrank(g) > GD_minrank(Z.z().Root))
2399 first--;
2400 last = GD_maxrank(g);
2401 dir = 1;
2402 } else { /* up pass */
2403 first = GD_maxrank(g) - 1;
2404 last = GD_minrank(g);
2405 if (GD_maxrank(g) < GD_maxrank(Z.z().Root))
2406 first++;
2407 dir = -1;
2408 }
2409 for (r = first; r != last + dir; r += dir) {
2410 other = r - dir;
2411 hasfixed = medians(g, r, other);
2412 reorder(g, r, reverse, hasfixed);
2413 }
2414 transpose(g, NOT(reverse));
2415 } finally {
2416 LEAVING("14t80owwvm7io4ou6czb9ba9","mincross_step");
2417 }
2418 }
2419
2420
2421
2422
2423 //3 aq18oa4k4grixvfjx7r2qnl6r
2424 // static int local_cross(elist l, int dir)
2425 public static int local_cross(final ST_elist l, int dir) {
2426 // WARNING!! STRUCT
2427 return local_cross_w_(l.copy(), dir);
2428 }
2429 private static int local_cross_w_(final ST_elist l, int dir) {
2430 ENTERING("aq18oa4k4grixvfjx7r2qnl6r","local_cross");
2431 try {
2432 UNSUPPORTED("3jmndo6p8u1x5wp297qpt0jto"); // static int local_cross(elist l, int dir)
2433 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
2434 UNSUPPORTED("2gmuwkiycm22in3d9obd7bzll"); // int i, j, is_out;
2435 UNSUPPORTED("bcforqedbns82qhgqkocjbvm"); // int cross = 0;
2436 UNSUPPORTED("9b48a157azcrz2ihzqehhpsvs"); // edge_t *e, *f;
2437 UNSUPPORTED("8az9seos08f2sa39127q6yo9"); // if (dir > 0)
2438 UNSUPPORTED("8xj2loay6suplxyiun7hlye39"); // is_out = NOT(0);
2439 UNSUPPORTED("div10atae09n36x269sl208r1"); // else
2440 UNSUPPORTED("56xhe3qw67sg923dvr87k8hho"); // is_out = 0;
2441 UNSUPPORTED("16t717mqlhfn3egmgor8are83"); // for (i = 0; (e = l.list[i]); i++) {
2442 UNSUPPORTED("3lbek06034x2gsimhxwfmgf0r"); // if (is_out)
2443 UNSUPPORTED("2pkmgz4cm8lwpwxgcg3znjm90"); // for (j = i + 1; (f = l.list[j]); j++) {
2444 UNSUPPORTED("8wj6phwqlmunjcua9abo6093d"); // if ((ND_order(aghead(f)) - ND_order(aghead(e)))
2445 UNSUPPORTED("pt12knuv94kokmtrwpdp1m0j"); // * (ED_tail_port(f).p.x - ED_tail_port(e).p.x) < 0)
2446 UNSUPPORTED("bw8rwv11yqzss88pad7ljil8a"); // cross += ED_xpenalty(e) * ED_xpenalty(f);
2447 UNSUPPORTED("6to1esmb8qfrhzgtr7jdqleja"); // } else
2448 UNSUPPORTED("2pkmgz4cm8lwpwxgcg3znjm90"); // for (j = i + 1; (f = l.list[j]); j++) {
2449 UNSUPPORTED("bza83c6rmihrkzyllwf0jm4tn"); // if ((ND_order(agtail(f)) - ND_order(agtail(e)))
2450 UNSUPPORTED("csrxg0y1azmvde7t833lm13sp"); // * (ED_head_port(f).p.x - ED_head_port(e).p.x) < 0)
2451 UNSUPPORTED("bw8rwv11yqzss88pad7ljil8a"); // cross += ED_xpenalty(e) * ED_xpenalty(f);
2452 UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
2453 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
2454 UNSUPPORTED("8dm5o3tsfvxtjilyob6q5ndi1"); // return cross;
2455 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
2456
2457 throw new UnsupportedOperationException();
2458 } finally {
2459 LEAVING("aq18oa4k4grixvfjx7r2qnl6r","local_cross");
2460 }
2461 }
2462
2463
2464
2465
2466 //static __ptr__ Count;
2467 //static int C;
2468 //3 bk5nklhfqgg0uwkv7tv6dn8r2
2469 // static int rcross(graph_t * g, int r)
2470 public static int rcross(ST_Agraph_s g, int r) {
2471 ENTERING("bk5nklhfqgg0uwkv7tv6dn8r2","rcross");
2472 try {
2473 int top, bot, cross, max, i, k;
2474 ST_Agnode_s v;
2475 ST_Agnode_s.ArrayOfStar rtop;
2476 cross = 0;
2477 max = 0;
2478 rtop = GD_rank(g).get(r).v;
2479 if (Z.z().C <= GD_rank(Z.z().Root).plus(r + 1).getPtr().n) {
2480 Z.z().C = GD_rank(Z.z().Root).plus(r + 1).getPtr().n + 1;
2481 Z.z().Count = ALLOC_INT(Z.z().C, Z.z().Count);
2482 }
2483 for (i = 0; i < GD_rank(g).get(r + 1).n; i++)
2484 Z.z().Count.plus(i).setInt(0);
2485 for (top = 0; top < GD_rank(g).get(r).n; top++) {
2486 ST_Agedge_s e;
2487 if (max > 0) {
2488 for (i = 0; (e = (ST_Agedge_s) ND_out(rtop.get(top)).getFromList(i))!=null; i++) {
2489 for (k = ND_order(aghead(e)) + 1; k <= max; k++)
2490 cross += Z.z().Count.plus(k).getInt() * ED_xpenalty(e);
2491 }
2492 }
2493 for (i = 0; (e = (ST_Agedge_s) ND_out(rtop.get(top)).getFromList(i))!=null; i++) {
2494 int inv = ND_order(aghead(e));
2495 if (inv > max)
2496 max = inv;
2497 Z.z().Count.plus(inv).setInt(Z.z().Count.plus(inv).getInt() + ED_xpenalty(e));
2498 }
2499 }
2500 for (top = 0; top < GD_rank(g).get(r).n; top++) {
2501 v = (ST_Agnode_s) GD_rank(g).get(r).v.get(top);
2502 if (ND_has_port(v))
2503 cross += local_cross(ND_out(v), 1);
2504 }
2505 for (bot = 0; bot < GD_rank(g).get(r + 1).n; bot++) {
2506 v = (ST_Agnode_s) GD_rank(g).get(r + 1).v.get(bot);
2507 if (ND_has_port(v))
2508 cross += local_cross(ND_in(v), -1);
2509 }
2510 return cross;
2511 } finally {
2512 LEAVING("bk5nklhfqgg0uwkv7tv6dn8r2","rcross");
2513 }
2514 }
2515
2516
2517
2518
2519 //3 dbjmz2tnii2pn9sxg26ap6w5r
2520 // int ncross(graph_t * g)
2521 public static int ncross(ST_Agraph_s g) {
2522 ENTERING("dbjmz2tnii2pn9sxg26ap6w5r","ncross");
2523 try {
2524 int r, count, nc;
2525 g = Z.z().Root;
2526 count = 0;
2527 for (r = GD_minrank(g); r < GD_maxrank(g); r++) {
2528 if (GD_rank(g).get(r).valid!=0)
2529 count += GD_rank(g).get(r).cache_nc;
2530 else {
2531 nc = rcross(g, r);
2532 GD_rank(g).get(r).cache_nc = nc;
2533 count += nc;
2534 GD_rank(g).plus(r).setInt("valid", 1);
2535 }
2536 }
2537 return count;
2538 } finally {
2539 LEAVING("dbjmz2tnii2pn9sxg26ap6w5r","ncross");
2540 }
2541 }
2542
2543
2544
2545
2546 //3 8wrsq8a2vooekcm3cdtv5x3ke
2547 // static int ordercmpf(int *i0, int *i1)
2548 public static int ordercmpf(__ptr__ i0, __ptr__ i1) {
2549 ENTERING("8wrsq8a2vooekcm3cdtv5x3ke","ordercmpf");
2550 try {
2551 return (i0.getInt()) - (i1.getInt());
2552 } finally {
2553 LEAVING("8wrsq8a2vooekcm3cdtv5x3ke","ordercmpf");
2554 }
2555 }
2556
2557
2558
2559
2560 //3 7397kynkpqf2m1jkpmi8pgf0n
2561 // static int flat_mval(node_t * n)
2562 public static boolean flat_mval(ST_Agnode_s n) {
2563 ENTERING("7397kynkpqf2m1jkpmi8pgf0n","flat_mval");
2564 try {
2565 int i;
2566 ST_Agedge_s e;
2567 List<ST_Agedge_s> fl;
2568 ST_Agnode_s nn;
2569 if (ND_flat_in(n).size > 0) {
2570 fl = ND_flat_in(n).list;
2571 nn = agtail(fl.get(0));
2572 for (i = 1; (e = (ST_Agedge_s) fl.get(i))!=null; i++)
2573 if (ND_order(agtail(e)) > ND_order(nn))
2574 nn = agtail(e);
2575 if (ND_mval(nn) >= 0) {
2576 ND_mval(n, ND_mval(nn) + 1);
2577 return false;
2578 }
2579 } else if (ND_flat_out(n).size > 0) {
2580 fl = ND_flat_out(n).list;
2581 nn = aghead(fl.get(0));
2582 for (i = 1; (e = (ST_Agedge_s) fl.get(i))!=null; i++)
2583 if (ND_order(aghead(e)) < ND_order(nn))
2584 nn = aghead(e);
2585 if (ND_mval(nn) > 0) {
2586 ND_mval(n, ND_mval(nn) - 1);
2587 return false;
2588 }
2589 }
2590 return NOT(false);
2591 } finally {
2592 LEAVING("7397kynkpqf2m1jkpmi8pgf0n","flat_mval");
2593 }
2594 }
2595
2596
2597
2598
2599 //3 azvdpixwwxspl31wp7f4k4fmh
2600 // static boolean medians(graph_t * g, int r0, int r1)
2601 public static boolean medians(ST_Agraph_s g, int r0, int r1) {
2602 ENTERING("azvdpixwwxspl31wp7f4k4fmh","medians");
2603 try {
2604 int i, j, j0, lm, rm, lspan, rspan;
2605 __ptr__ list;
2606 ST_Agnode_s n;
2607 ST_Agnode_s.ArrayOfStar v;
2608 ST_Agedge_s e;
2609 boolean hasfixed = false;
2610 list = Z.z().TI_list;
2611 v = GD_rank(g).get(r0).v;
2612 for (i = 0; i < GD_rank(g).get(r0).n; i++) {
2613 n = (ST_Agnode_s) v.get(i);
2614 j = 0;
2615 if (r1 > r0)
2616 for (j0 = 0; (e = (ST_Agedge_s) ND_out(n).getFromList(j0))!=null; j0++) {
2617 if (ED_xpenalty(e) > 0)
2618 list.plus(j++).setInt((256 * ND_order(aghead(e)) + (ED_head_port(e)).order));
2619 } else
2620 for (j0 = 0; (e = (ST_Agedge_s) ND_in(n).getFromList(j0))!=null; j0++) {
2621 if (ED_xpenalty(e) > 0)
2622 list.plus(j++).setInt((256 * ND_order(agtail(e)) + (ED_tail_port(e)).order));
2623 }
2624 switch (j) {
2625 case 0:
2626 ND_mval(n, -1);
2627 break;
2628 case 1:
2629 ND_mval(n, list.plus(0).getInt());
2630 break;
2631 case 2:
2632 ND_mval(n, (list.plus(0).getInt() + list.plus(1).getInt()) / 2);
2633 break;
2634 default:
2635 qsort(list,
2636 j,
2637 function(mincross__c.class, "ordercmpf"));
2638 if (j % 2!=0)
2639 ND_mval(n, list.plus(j / 2).getInt());
2640 else {
2641 /* weighted median */
2642 rm = j / 2;
2643 lm = rm - 1;
2644 rspan = list.plus(j - 1).getInt() - list.plus(rm).getInt();
2645 lspan = list.plus(lm).getInt() - list.plus(0).getInt();
2646 if (lspan == rspan)
2647 ND_mval(n, (list.plus(lm).getInt() + list.plus(rm).getInt()) / 2);
2648 else {
2649 int w = list.plus(lm).getInt() * rspan + list.plus(rm).getInt() * lspan;
2650 ND_mval(n, w / (lspan + rspan));
2651 }
2652 }
2653 }
2654 }
2655 for (i = 0; i < GD_rank(g).get(r0).n; i++) {
2656 n = (ST_Agnode_s) v.get(i);
2657 if ((ND_out(n).size == 0) && (ND_in(n).size == 0))
2658 hasfixed |= flat_mval(n);
2659 }
2660 return hasfixed;
2661 } finally {
2662 LEAVING("azvdpixwwxspl31wp7f4k4fmh","medians");
2663 }
2664 }
2665
2666
2667
2668
2669 //3 2vdhpcykq508ma83aif8sxcbd
2670 // static int nodeposcmpf(node_t ** n0, node_t ** n1)
2671 public static Object nodeposcmpf(__ptr__ n0, __ptr__ n1) {
2672 ENTERING("2vdhpcykq508ma83aif8sxcbd","nodeposcmpf");
2673 try {
2674 return (ND_order(n0.getPtr()) - ND_order(n1.getPtr()));
2675 } finally {
2676 LEAVING("2vdhpcykq508ma83aif8sxcbd","nodeposcmpf");
2677 }
2678 }
2679
2680
2681
2682
2683 //3 87c98ld9c4hv87ekcxdyojx8l
2684 // static int edgeidcmpf(edge_t ** e0, edge_t ** e1)
2685 public static Object edgeidcmpf(Object... arg) {
2686 UNSUPPORTED("apvyql25ya1p7w7i7396gucdg"); // static int edgeidcmpf(edge_t ** e0, edge_t ** e1)
2687 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
2688 UNSUPPORTED("9gjc2rit3ezq4il0t5aymk1z"); // return (AGSEQ(*e0) - AGSEQ(*e1));
2689 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
2690
2691 throw new UnsupportedOperationException();
2692 }
2693
2694
2695 //1 40as9opn4mzq4gp4nkmp4dj8w
2696 // static int table[3][3] =
2697 private static int table[][] = new int[][]{
2698 /* ordinary */ {1, 1, 1},
2699 /* singleton */ {1, 2, 2},
2700 /* virtual */ {1, 2, 4}
2701 };
2702
2703
2704
2705 //3 7j638prioxd97f74v1v4adbsf
2706 // static int endpoint_class(node_t * n)
2707 public static int endpoint_class(ST_Agnode_s n) {
2708 ENTERING("7j638prioxd97f74v1v4adbsf","endpoint_class");
2709 try {
2710 if (ND_node_type(n) == 1)
2711 return 2;
2712 if (ND_weight_class(n) <= 1)
2713 return 1;
2714 return 0;
2715 } finally {
2716 LEAVING("7j638prioxd97f74v1v4adbsf","endpoint_class");
2717 }
2718 }
2719
2720
2721
2722
2723 //3 es57bn7ga4wc9tqtcixpn0451
2724 // void virtual_weight(edge_t * e)
2725 public static void virtual_weight(ST_Agedge_s e) {
2726 ENTERING("es57bn7ga4wc9tqtcixpn0451","virtual_weight");
2727 try {
2728 int t;
2729 t = table[endpoint_class(agtail(e))][endpoint_class(aghead(e))];
2730 ED_weight(e, ED_weight(e) * t);
2731 } finally {
2732 LEAVING("es57bn7ga4wc9tqtcixpn0451","virtual_weight");
2733 }
2734 }
2735
2736
2737
2738
2739 //3 7ru09oqbudpeofsthzveig2m2
2740 // static void mincross_options(graph_t * g)
2741 public static void mincross_options(ST_Agraph_s g) {
2742 ENTERING("7ru09oqbudpeofsthzveig2m2","mincross_options");
2743 try {
2744 CString p;
2745 double f;
2746 /* set default values */
2747 Z.z().MinQuit = 8;
2748 Z.z().MaxIter = 24;
2749 Z.z().Convergence = .995;
2750 p = agget(g, new CString("mclimit"));
2751 if (p!=null && ((f = atof(p)) > 0.0)) {
2752 UNSUPPORTED("4iu53eiz077u6joqgwawca8ya"); // MinQuit = ((1)>(MinQuit * f)?(1):(MinQuit * f));
2753 UNSUPPORTED("38po81l36cibw6jc3qlsscpcu"); // MaxIter = ((1)>(MaxIter * f)?(1):(MaxIter * f));
2754 }
2755 } finally {
2756 LEAVING("7ru09oqbudpeofsthzveig2m2","mincross_options");
2757 }
2758 }
2759
2760
2761 }