| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 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 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
public static Object pointof(Object... arg) { |
| 385 |
UNSUPPORTED("8e4tj258yvfq5uhsdpk37n5eq"); |
| 386 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 387 |
UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); |
| 388 |
UNSUPPORTED("12jimkrzqxavaie0cpapbx18c"); |
| 389 |
UNSUPPORTED("7ivmviysahgsc5nn9gtp7q2if"); |
| 390 |
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); |
| 391 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 392 |
|
| 393 |
throw new UnsupportedOperationException(); |
| 394 |
} |
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
public static ST_pointf pointfof(double x, double y) { |
| 402 |
|
| 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 |
|
| 421 |
|
| 422 |
public static Object boxof(Object... arg) { |
| 423 |
UNSUPPORTED("3lzesfdd337h31jrlib1czocm"); |
| 424 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 425 |
UNSUPPORTED("52u27kayecy1i1e8bbo8f7s9r"); |
| 426 |
UNSUPPORTED("cylhjlutoc0sc0uy7g98m9fb8"); |
| 427 |
UNSUPPORTED("242of6revxzx8hpe7yerrchz6"); |
| 428 |
UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); |
| 429 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 430 |
|
| 431 |
throw new UnsupportedOperationException(); |
| 432 |
} |
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
public static Object add_point(Object... arg) { |
| 443 |
UNSUPPORTED("6iamka1fx8fk1rohzzse8phte"); |
| 444 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 445 |
UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); |
| 446 |
UNSUPPORTED("3n2sizjd0civbzm6iq7su1s2p"); |
| 447 |
UNSUPPORTED("65ygdo31w09i5i6bd2f7azcd3"); |
| 448 |
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); |
| 449 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 450 |
|
| 451 |
throw new UnsupportedOperationException(); |
| 452 |
} |
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
public static ST_pointf add_pointf(final ST_pointf p, final ST_pointf q) { |
| 460 |
|
| 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 |
|
| 479 |
|
| 480 |
public static Object sub_point(Object... arg) { |
| 481 |
UNSUPPORTED("cd602849h0bce8lu9xegka0ia"); |
| 482 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 483 |
UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); |
| 484 |
UNSUPPORTED("4q4q9dveah93si8ajfv59gz27"); |
| 485 |
UNSUPPORTED("9f90ik0o2yqhanzntpy3d2ydy"); |
| 486 |
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); |
| 487 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 488 |
|
| 489 |
throw new UnsupportedOperationException(); |
| 490 |
} |
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
public static Object sub_pointf(Object... arg) { |
| 498 |
UNSUPPORTED("dmufj44lddsnj0wjyxsg2fcso"); |
| 499 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 500 |
UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); |
| 501 |
UNSUPPORTED("4q4q9dveah93si8ajfv59gz27"); |
| 502 |
UNSUPPORTED("9f90ik0o2yqhanzntpy3d2ydy"); |
| 503 |
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); |
| 504 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 505 |
|
| 506 |
throw new UnsupportedOperationException(); |
| 507 |
} |
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
public static Object mid_point(Object... arg) { |
| 515 |
UNSUPPORTED("evy44tdsmu3erff9dp2x835u2"); |
| 516 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 517 |
UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); |
| 518 |
UNSUPPORTED("1a6p6fm57o0wt5ze2btsx06c7"); |
| 519 |
UNSUPPORTED("1kbj5tgdmfi6kf4jgg6skhr6e"); |
| 520 |
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); |
| 521 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 522 |
|
| 523 |
throw new UnsupportedOperationException(); |
| 524 |
} |
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
public static Object mid_pointf(Object... arg) { |
| 532 |
UNSUPPORTED("381o63o9kb04d7gzg65v0r3q"); |
| 533 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 534 |
UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); |
| 535 |
UNSUPPORTED("c5vboetlr3mf43wns7iik6m1w"); |
| 536 |
UNSUPPORTED("bcdf562ldr3bjn78hcay5xd63"); |
| 537 |
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); |
| 538 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 539 |
|
| 540 |
throw new UnsupportedOperationException(); |
| 541 |
} |
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
public static Object interpolate_pointf(Object... arg) { |
| 549 |
UNSUPPORTED("894yimn33kmtm454llwdaotu8"); |
| 550 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 551 |
UNSUPPORTED("ef2acl8wa2ooqcb5vz3098maz"); |
| 552 |
UNSUPPORTED("5tpwuyf5iidesy80v8o4nwkmk"); |
| 553 |
UNSUPPORTED("ewnrc5uloj3w5jbmsjcn3wja0"); |
| 554 |
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); |
| 555 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 556 |
|
| 557 |
throw new UnsupportedOperationException(); |
| 558 |
} |
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
public static Object exch_xy(Object... arg) { |
| 566 |
UNSUPPORTED("2vxya0v2fzlv5e0vjaa8d414"); |
| 567 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 568 |
UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); |
| 569 |
UNSUPPORTED("60cojdwc2h7f0m51s9jdwvup7"); |
| 570 |
UNSUPPORTED("evp2x66oa4s1tlnc0ytxq2qbq"); |
| 571 |
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); |
| 572 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 573 |
|
| 574 |
throw new UnsupportedOperationException(); |
| 575 |
} |
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
public static Object exch_xyf(Object... arg) { |
| 583 |
UNSUPPORTED("8qamrobrqi8jsvvfrxkimrsnw"); |
| 584 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 585 |
UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); |
| 586 |
UNSUPPORTED("60cojdwc2h7f0m51s9jdwvup7"); |
| 587 |
UNSUPPORTED("evp2x66oa4s1tlnc0ytxq2qbq"); |
| 588 |
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); |
| 589 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 590 |
|
| 591 |
throw new UnsupportedOperationException(); |
| 592 |
} |
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
public static Object box_bb(Object... arg) { |
| 600 |
UNSUPPORTED("36et5gmnjrby6o7bq9sgh1hx6"); |
| 601 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 602 |
UNSUPPORTED("52u27kayecy1i1e8bbo8f7s9r"); |
| 603 |
UNSUPPORTED("8mr2c9xitsqi8z1plbp7ox1hu"); |
| 604 |
UNSUPPORTED("2egu55ef4u1i03nwz01k7kcrl"); |
| 605 |
UNSUPPORTED("9n6ei3odbgefwfxvql9whcpe"); |
| 606 |
UNSUPPORTED("19ocysbuh4pxyft2bqhyhigr1"); |
| 607 |
UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); |
| 608 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 609 |
|
| 610 |
throw new UnsupportedOperationException(); |
| 611 |
} |
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
public static Object boxf_bb(Object... arg) { |
| 619 |
UNSUPPORTED("dyrqu4ww9osr9c86gqgmifcp6"); |
| 620 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 621 |
UNSUPPORTED("c57pq0f87j6dnbcvygu7v6k84"); |
| 622 |
UNSUPPORTED("8mr2c9xitsqi8z1plbp7ox1hu"); |
| 623 |
UNSUPPORTED("2egu55ef4u1i03nwz01k7kcrl"); |
| 624 |
UNSUPPORTED("9n6ei3odbgefwfxvql9whcpe"); |
| 625 |
UNSUPPORTED("19ocysbuh4pxyft2bqhyhigr1"); |
| 626 |
UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); |
| 627 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 628 |
|
| 629 |
throw new UnsupportedOperationException(); |
| 630 |
} |
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
public static Object box_intersect(Object... arg) { |
| 638 |
UNSUPPORTED("34gv28cldst09bl71itjgviue"); |
| 639 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 640 |
UNSUPPORTED("52u27kayecy1i1e8bbo8f7s9r"); |
| 641 |
UNSUPPORTED("9slu7bixuymxttjic76ha2nl2"); |
| 642 |
UNSUPPORTED("3uv943c2f82yuif249pf5azob"); |
| 643 |
UNSUPPORTED("74tf5h16bc9zabq3s3dyny543"); |
| 644 |
UNSUPPORTED("d99gcv3i7xes7y7rqf8ii20ux"); |
| 645 |
UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); |
| 646 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 647 |
|
| 648 |
throw new UnsupportedOperationException(); |
| 649 |
} |
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
public static Object boxf_intersect(Object... arg) { |
| 657 |
UNSUPPORTED("ape22b8z6jfg17gvo42hok9eb"); |
| 658 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 659 |
UNSUPPORTED("c57pq0f87j6dnbcvygu7v6k84"); |
| 660 |
UNSUPPORTED("9slu7bixuymxttjic76ha2nl2"); |
| 661 |
UNSUPPORTED("3uv943c2f82yuif249pf5azob"); |
| 662 |
UNSUPPORTED("74tf5h16bc9zabq3s3dyny543"); |
| 663 |
UNSUPPORTED("d99gcv3i7xes7y7rqf8ii20ux"); |
| 664 |
UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); |
| 665 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 666 |
|
| 667 |
throw new UnsupportedOperationException(); |
| 668 |
} |
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
public static Object box_overlap(Object... arg) { |
| 676 |
UNSUPPORTED("1e9k599x7ygct7r4cfdxlk9u9"); |
| 677 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 678 |
UNSUPPORTED("7a9wwpu7dhdphd08y1ecw54w5"); |
| 679 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 680 |
|
| 681 |
throw new UnsupportedOperationException(); |
| 682 |
} |
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
public static Object boxf_overlap(Object... arg) { |
| 690 |
UNSUPPORTED("905nejsewihwhhc3bhnrz9nwo"); |
| 691 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 692 |
UNSUPPORTED("7a9wwpu7dhdphd08y1ecw54w5"); |
| 693 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 694 |
|
| 695 |
throw new UnsupportedOperationException(); |
| 696 |
} |
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
public static Object box_contains(Object... arg) { |
| 704 |
UNSUPPORTED("aputfc30fjkvy6jx4otljaczq"); |
| 705 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 706 |
UNSUPPORTED("87ap80vrh2a4gpprbxr33lrg3"); |
| 707 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 708 |
|
| 709 |
throw new UnsupportedOperationException(); |
| 710 |
} |
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
public static Object boxf_contains(Object... arg) { |
| 718 |
UNSUPPORTED("7ccnttkiwt834yfyw0evcm18v"); |
| 719 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 720 |
UNSUPPORTED("87ap80vrh2a4gpprbxr33lrg3"); |
| 721 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 722 |
|
| 723 |
throw new UnsupportedOperationException(); |
| 724 |
} |
| 725 |
|
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
public static Object perp(Object... arg) { |
| 732 |
UNSUPPORTED("567wpqlg9rv63ynyvxd9sgkww"); |
| 733 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 734 |
UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); |
| 735 |
UNSUPPORTED("2fyydy6t6yifjsczccsb9szeg"); |
| 736 |
UNSUPPORTED("evp2x66oa4s1tlnc0ytxq2qbq"); |
| 737 |
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); |
| 738 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 739 |
|
| 740 |
throw new UnsupportedOperationException(); |
| 741 |
} |
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
public static Object scale(Object... arg) { |
| 749 |
UNSUPPORTED("c1ngytew34bmkdb7vps5h3dh8"); |
| 750 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 751 |
UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); |
| 752 |
UNSUPPORTED("dznf7nac14snww4usquyd6r3r"); |
| 753 |
UNSUPPORTED("33kk73m8vjcux5tnjl8co2pe6"); |
| 754 |
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); |
| 755 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 756 |
|
| 757 |
throw new UnsupportedOperationException(); |
| 758 |
} |
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
|
| 763 |
|
| 764 |
|
| 765 |
public static Object gd_minrank(Object... arg) { |
| 766 |
UNSUPPORTED("7wnr5wvv8mw2d3mfdyvdz5kz9"); |
| 767 |
|
| 768 |
throw new UnsupportedOperationException(); |
| 769 |
} |
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
public static Object gd_maxrank(Object... arg) { |
| 777 |
UNSUPPORTED("b89n5iyqsgra9z559023bf23e"); |
| 778 |
|
| 779 |
throw new UnsupportedOperationException(); |
| 780 |
} |
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
public static Object gd_rank(Object... arg) { |
| 788 |
UNSUPPORTED("bxd4rm18v4y2x6fo30vh9pauo"); |
| 789 |
|
| 790 |
throw new UnsupportedOperationException(); |
| 791 |
} |
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
|
| 798 |
public static Object nd_order(Object... arg) { |
| 799 |
UNSUPPORTED("f4zvlmxyp6gei8iiu33hpz4oe"); |
| 800 |
|
| 801 |
throw new UnsupportedOperationException(); |
| 802 |
} |
| 803 |
|
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
|
| 816 |
|
| 817 |
|
| 818 |
|
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
|
| 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 |
|
| 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 |
|
| 868 |
|
| 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]; |
| 876 |
return rv; |
| 877 |
} finally { |
| 878 |
LEAVING("756bre1tpxb1tq68p7xhkrxkc","new_matrix"); |
| 879 |
} |
| 880 |
} |
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
|
| 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 |
|
| 903 |
|
| 904 |
public static void init_mccomp(ST_Agraph_s g, int c) { |
| 905 |
ENTERING("49vw7fkn99wbojtfksugvuruh","init_mccomp"); |
| 906 |
try { |
| 907 |
int r; |
| 908 |
|
| 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 |
|
| 925 |
|
| 926 |
public static Object betweenclust(Object... arg) { |
| 927 |
UNSUPPORTED("6k6r73j7gctt4ntepjubrlfze"); |
| 928 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 929 |
UNSUPPORTED("1z9f8ptfggp4qlwv5cdd55i3j"); |
| 930 |
UNSUPPORTED("bdmai1d040qmubf08ds339v9x"); |
| 931 |
UNSUPPORTED("eq2o4v9qo3xx42in97ssadek"); |
| 932 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 933 |
|
| 934 |
throw new UnsupportedOperationException(); |
| 935 |
} |
| 936 |
|
| 937 |
|
| 938 |
|
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
public static Object do_ordering_node(Object... arg) { |
| 943 |
UNSUPPORTED("ajn55zvrzf8njqkshll3kaz88"); |
| 944 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 945 |
UNSUPPORTED("bp5tdulayknsvyv8a2j2tinh"); |
| 946 |
UNSUPPORTED("5yrhx4blosxo5xnc1nh1kzhfs"); |
| 947 |
UNSUPPORTED("9cbk3ly04nbzqoxmmjwptqq9a"); |
| 948 |
UNSUPPORTED("5ol5beitdgh7axwpk35pc9trm"); |
| 949 |
UNSUPPORTED("aeria2or5qpnnrr9wm15k588l"); |
| 950 |
UNSUPPORTED("a7fgam0j0jm7bar0mblsv3no4"); |
| 951 |
UNSUPPORTED("442hvc4h32o6e3cvzm5y5y3oq"); |
| 952 |
UNSUPPORTED("7xi4jdz18dyv740agfh5uwtxv"); |
| 953 |
UNSUPPORTED("24smn55xhvkklh2do2cfcmy98"); |
| 954 |
UNSUPPORTED("ouas2w3lk54dwigzgglm3w7r"); |
| 955 |
UNSUPPORTED("c07up7zvrnu2vhzy6d7zcu94g"); |
| 956 |
UNSUPPORTED("6dgl0skwzmsi69ugcewc5vwaf"); |
| 957 |
UNSUPPORTED("24smn55xhvkklh2do2cfcmy98"); |
| 958 |
UNSUPPORTED("ouas2w3lk54dwigzgglm3w7r"); |
| 959 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 960 |
UNSUPPORTED("hdnqvw2crdbzt2uenqso4l7k"); |
| 961 |
UNSUPPORTED("a7fgam0j0jm7bar0mblsv3no4"); |
| 962 |
UNSUPPORTED("4zkjvsomlyhcl06ummf4gz0d2"); |
| 963 |
UNSUPPORTED("2zx16rdu8hp86z3z36natgy8t"); |
| 964 |
UNSUPPORTED("6dp57feioscwstrfmhqhrz1jx"); |
| 965 |
UNSUPPORTED("4wqnlh6z9lr2xvmjp95nozn84"); |
| 966 |
UNSUPPORTED("d6aia9q03brt8otnyu5m3tlxj"); |
| 967 |
UNSUPPORTED("1b9ylnvr8zscovbyrxoe9ypax"); |
| 968 |
UNSUPPORTED("4nbrepm0pmohxxml0csb9j5xc"); |
| 969 |
UNSUPPORTED("2rcn453iomwvou108kjr2rboc"); |
| 970 |
UNSUPPORTED("96i3kysq5lfoyukhe65vpiah2"); |
| 971 |
UNSUPPORTED("7yhr8hn3r6wohafwxrt85b2j2"); |
| 972 |
UNSUPPORTED("96jttvtco2oqt3y3qr5fbhu1j"); |
| 973 |
UNSUPPORTED("8g5mzwux62x43bjzeslylyi0g"); |
| 974 |
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); |
| 975 |
UNSUPPORTED("a7mygw39shaa9w4l8fdlgqr0i"); |
| 976 |
UNSUPPORTED("6cprbghvenu9ldc0ez1ifc63q"); |
| 977 |
UNSUPPORTED("aoa2embk8eaij29q6nbl4e5tk"); |
| 978 |
UNSUPPORTED("67t5g8eu9tdqbnwj4s4g6ah6u"); |
| 979 |
UNSUPPORTED("b32n066t1nkgj646wvo7vuwlq"); |
| 980 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 981 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 982 |
|
| 983 |
throw new UnsupportedOperationException(); |
| 984 |
} |
| 985 |
|
| 986 |
|
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
public static Object do_ordering(Object... arg) { |
| 992 |
UNSUPPORTED("9v68euuxlii02rb5mhlyd8alp"); |
| 993 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 994 |
UNSUPPORTED("5y5mm5obhrqt745c4fx4o0r56"); |
| 995 |
UNSUPPORTED("cjx5v6hayed3q8eeub1cggqca"); |
| 996 |
UNSUPPORTED("44thr6ep72jsj3fksjiwdx3yr"); |
| 997 |
UNSUPPORTED("bicm0b87pp2rusaezmk6qigjq"); |
| 998 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 999 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 1000 |
|
| 1001 |
throw new UnsupportedOperationException(); |
| 1002 |
} |
| 1003 |
|
| 1004 |
|
| 1005 |
|
| 1006 |
|
| 1007 |
|
| 1008 |
|
| 1009 |
public static Object do_ordering_for_nodes(Object... arg) { |
| 1010 |
UNSUPPORTED("7yd9vingwgdcdtrx0p38jti00"); |
| 1011 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 1012 |
UNSUPPORTED("887aairlqk73reuayo3hz67v3"); |
| 1013 |
UNSUPPORTED("cjx5v6hayed3q8eeub1cggqca"); |
| 1014 |
UNSUPPORTED("cbbfhy5qk3dailijtedj1czut"); |
| 1015 |
UNSUPPORTED("44thr6ep72jsj3fksjiwdx3yr"); |
| 1016 |
UNSUPPORTED("ekvbu44bbrdwkw71yd21dbns9"); |
| 1017 |
UNSUPPORTED("7jueg5punlemj6mfbpgltb5u8"); |
| 1018 |
UNSUPPORTED("302oz5j9wva90otn6jq513bme"); |
| 1019 |
UNSUPPORTED("1dt1hft3eak5ytycs6dh7yk0"); |
| 1020 |
UNSUPPORTED("dnig45so0x904azp9fhxymqjn"); |
| 1021 |
UNSUPPORTED("2rxgmu8cktngvqtsex2rlbjed"); |
| 1022 |
UNSUPPORTED("axk3fxl1bh09n475kmcx42kdu"); |
| 1023 |
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); |
| 1024 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1025 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 1026 |
|
| 1027 |
throw new UnsupportedOperationException(); |
| 1028 |
} |
| 1029 |
|
| 1030 |
|
| 1031 |
|
| 1032 |
|
| 1033 |
|
| 1034 |
|
| 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"); |
| 1042 |
UNSUPPORTED("lhhw62wj3on36enoy6ug6u1p"); |
| 1043 |
UNSUPPORTED("ctbadiyd3jjtlt2f5t9p94au7"); |
| 1044 |
UNSUPPORTED("259y9uhqwc8w6jhrpm1eaa7hf"); |
| 1045 |
UNSUPPORTED("312ij4z5d42rye9s30l9io097"); |
| 1046 |
UNSUPPORTED("25yw5chxmy54pmo88tre1w2ir"); |
| 1047 |
UNSUPPORTED("5ugg9zy8378pijqru97mxmen5"); |
| 1048 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1049 |
UNSUPPORTED("div10atae09n36x269sl208r1"); |
| 1050 |
UNSUPPORTED("6ld19omy1z68vprfzbhrjqr2z"); |
| 1051 |
UNSUPPORTED("50itbchatjp61haxvg3xnhvoo"); |
| 1052 |
UNSUPPORTED("evzjoqkm2xukapjvpccu2f23e"); |
| 1053 |
UNSUPPORTED("1016hqxaexp4j33vmkzvdpq80"); |
| 1054 |
UNSUPPORTED("7ah0zlu96u6g6cquxebenj4z3"); |
| 1055 |
UNSUPPORTED("7sqzaehh40dvpm11hlxhef6cw"); |
| 1056 |
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); |
| 1057 |
UNSUPPORTED("h2b3ao18r091ie7yk9v20pqq"); |
| 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 |
|
| 1071 |
|
| 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 |
|
| 1094 |
|
| 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 |
|
| 1101 |
if (Z.z().ReMincross == false) { |
| 1102 |
if (NEQ(ND_clust(v), ND_clust(w)) && (ND_clust(v)!=null) && (ND_clust(w)!=null)) { |
| 1103 |
|
| 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 |
|
| 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 |
|
| 1138 |
|
| 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 |
|
| 1166 |
|
| 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 |
|
| 1194 |
|
| 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 |
|
| 1215 |
|
| 1216 |
public static Object balanceNodes(Object... arg) { |
| 1217 |
UNSUPPORTED("504qsj6detmzllj50pno6sdx4"); |
| 1218 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 1219 |
UNSUPPORTED("dor7xumwnqvymg7xdesa6pxqn"); |
| 1220 |
UNSUPPORTED("c6s55weiu8hc4voeunxf2utru"); |
| 1221 |
UNSUPPORTED("6gqdkaiir2naiawry8cnlpf4a"); |
| 1222 |
UNSUPPORTED("2dqxr1ujg381s9ugf0367iici"); |
| 1223 |
UNSUPPORTED("7yj94w2zpwdubyzymyljw490a"); |
| 1224 |
UNSUPPORTED("6mq7c2z232o8kvpp371lfmewh"); |
| 1225 |
UNSUPPORTED("53kjkk6c0h35zpbikj9y2q6b4"); |
| 1226 |
UNSUPPORTED("a7fgam0j0jm7bar0mblsv3no4"); |
| 1227 |
UNSUPPORTED("5ylcsv8rwps97qz7sdftpwrka"); |
| 1228 |
UNSUPPORTED("5025o4uc5dkbxf3smi3kmfoit"); |
| 1229 |
UNSUPPORTED("d87qjwxc2qjvh6hb9fmi9y9vq"); |
| 1230 |
UNSUPPORTED("dcny4syjny1sh20jyjjl7jj62"); |
| 1231 |
UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); |
| 1232 |
UNSUPPORTED("bbpsgrsgquajs3xxqzeqvgv6n"); |
| 1233 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1234 |
UNSUPPORTED("2qx27p3loyln3i09ycwf5p1dh"); |
| 1235 |
UNSUPPORTED("ex9drrxqg8zalagzrnvrulrlb"); |
| 1236 |
UNSUPPORTED("jtm789r1sqidxc39d09n9det"); |
| 1237 |
UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); |
| 1238 |
UNSUPPORTED("c31t0vnbzvj9zml7p91syjzep"); |
| 1239 |
UNSUPPORTED("c07up7zvrnu2vhzy6d7zcu94g"); |
| 1240 |
UNSUPPORTED("ex9drrxqg8zalagzrnvrulrlb"); |
| 1241 |
UNSUPPORTED("c31t0vnbzvj9zml7p91syjzep"); |
| 1242 |
UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); |
| 1243 |
UNSUPPORTED("jtm789r1sqidxc39d09n9det"); |
| 1244 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1245 |
UNSUPPORTED("ejbeaepbxwawm7mvtusyi2x57"); |
| 1246 |
UNSUPPORTED("5025o4uc5dkbxf3smi3kmfoit"); |
| 1247 |
UNSUPPORTED("afetrkwabtn6v07evr5japsk5"); |
| 1248 |
UNSUPPORTED("bvwqg08b9hn6rfdx11sjq0hgc"); |
| 1249 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1250 |
UNSUPPORTED("ecis6irl9vire6ejfrshttjk4"); |
| 1251 |
UNSUPPORTED("1i78b3w9omzkba0pmafwfunbj"); |
| 1252 |
UNSUPPORTED("1f2jn45p7wv1ud964k43lgdss"); |
| 1253 |
UNSUPPORTED("795vpnc8yojryr8b46aidsu69"); |
| 1254 |
UNSUPPORTED("5l8w7t0ta6p6hnfp72l7lbqey"); |
| 1255 |
UNSUPPORTED("49j09cv8f8ien7kqoguzywjmw"); |
| 1256 |
UNSUPPORTED("borg3y7rgdooetc6ckrsrg9fc"); |
| 1257 |
UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); |
| 1258 |
UNSUPPORTED("ai3czg6gaaxspsmndknpyvuiu"); |
| 1259 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1260 |
UNSUPPORTED("cuj70hyout6yv30drqkjiwllo"); |
| 1261 |
UNSUPPORTED("49j09cv8f8ien7kqoguzywjmw"); |
| 1262 |
UNSUPPORTED("d35zlcj7podjjns9eg2ttocr7"); |
| 1263 |
UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); |
| 1264 |
UNSUPPORTED("ai3czg6gaaxspsmndknpyvuiu"); |
| 1265 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1266 |
UNSUPPORTED("9r0b42aqwdlx2cg7aqsxgle1o"); |
| 1267 |
UNSUPPORTED("cvktng9nwm6futhlv28bqbqy"); |
| 1268 |
UNSUPPORTED("ejbeaepbxwawm7mvtusyi2x57"); |
| 1269 |
UNSUPPORTED("5025o4uc5dkbxf3smi3kmfoit"); |
| 1270 |
UNSUPPORTED("afetrkwabtn6v07evr5japsk5"); |
| 1271 |
UNSUPPORTED("bvwqg08b9hn6rfdx11sjq0hgc"); |
| 1272 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1273 |
UNSUPPORTED("1i78b3w9omzkba0pmafwfunbj"); |
| 1274 |
UNSUPPORTED("1f2jn45p7wv1ud964k43lgdss"); |
| 1275 |
UNSUPPORTED("795vpnc8yojryr8b46aidsu69"); |
| 1276 |
UNSUPPORTED("5l8w7t0ta6p6hnfp72l7lbqey"); |
| 1277 |
UNSUPPORTED("49j09cv8f8ien7kqoguzywjmw"); |
| 1278 |
UNSUPPORTED("eer25fyjj3njh33v709xj07lk"); |
| 1279 |
UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); |
| 1280 |
UNSUPPORTED("ai3czg6gaaxspsmndknpyvuiu"); |
| 1281 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1282 |
UNSUPPORTED("cuj70hyout6yv30drqkjiwllo"); |
| 1283 |
UNSUPPORTED("49j09cv8f8ien7kqoguzywjmw"); |
| 1284 |
UNSUPPORTED("80ptwhmp1gyks2xfkcjub24o9"); |
| 1285 |
UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); |
| 1286 |
UNSUPPORTED("ai3czg6gaaxspsmndknpyvuiu"); |
| 1287 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1288 |
UNSUPPORTED("6yjcl5tugkib89c3p3beoi0cs"); |
| 1289 |
UNSUPPORTED("4hhzcihijbcjb2mo6eop9g855"); |
| 1290 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1291 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 1292 |
|
| 1293 |
throw new UnsupportedOperationException(); |
| 1294 |
} |
| 1295 |
|
| 1296 |
|
| 1297 |
|
| 1298 |
|
| 1299 |
|
| 1300 |
|
| 1301 |
public static Object balance(Object... arg) { |
| 1302 |
UNSUPPORTED("4223t6rekw3qd8eksvz9kjcqh"); |
| 1303 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 1304 |
UNSUPPORTED("970giwpms1ljmt0px5djlqs0z"); |
| 1305 |
UNSUPPORTED("8xqnhjfdqnlwlyld1ep6hpnmb"); |
| 1306 |
UNSUPPORTED("p6jnh7nvcpnl3zbz636pskbs"); |
| 1307 |
UNSUPPORTED("yy0fwjrmxw3jbi85mvwrka7f"); |
| 1308 |
UNSUPPORTED("9ey19t6tw2srzaedeng4sq96z"); |
| 1309 |
UNSUPPORTED("2nlemgjbnd1ygry42bcbuwo9y"); |
| 1310 |
UNSUPPORTED("91gzxbmcoy5xbvf8nlhmlj4eh"); |
| 1311 |
UNSUPPORTED("5ekdr3i8niy7x2ohi7ftgmjke"); |
| 1312 |
UNSUPPORTED("efwyjm6j3e7byt6z83lrhgd1r"); |
| 1313 |
UNSUPPORTED("8ey6umhtefcrb61ncgis82hw6"); |
| 1314 |
UNSUPPORTED("ddkyq74d5rjfcofczt4hmkxsj"); |
| 1315 |
UNSUPPORTED("6hyelvzskqfqa07xtgjtvg2is"); |
| 1316 |
UNSUPPORTED("cdpfb5fmlhe0831jf96pjp9s0"); |
| 1317 |
UNSUPPORTED("3l676z6ajeugxvie4r957jap3"); |
| 1318 |
UNSUPPORTED("ennnd5cl9xhh55j2bni58iuxv"); |
| 1319 |
UNSUPPORTED("bk4dl2r7nw7j8xvkpg7g7x0z9"); |
| 1320 |
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); |
| 1321 |
UNSUPPORTED("f0ordylgf44hx2l90eof067yo"); |
| 1322 |
UNSUPPORTED("d945airzpo5xbu0fz68ylmgql"); |
| 1323 |
UNSUPPORTED("e6ez0uwca50uwo7i7i4vak4f2"); |
| 1324 |
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); |
| 1325 |
UNSUPPORTED("884yfwkgyw57w5ivpfrggmq15"); |
| 1326 |
UNSUPPORTED("c2sevxb1gtyc2olq8akmvs40u"); |
| 1327 |
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); |
| 1328 |
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); |
| 1329 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1330 |
UNSUPPORTED("v7vqc9l7ge2bfdwnw11z7rzi"); |
| 1331 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 1332 |
|
| 1333 |
throw new UnsupportedOperationException(); |
| 1334 |
} |
| 1335 |
|
| 1336 |
|
| 1337 |
|
| 1338 |
|
| 1339 |
|
| 1340 |
|
| 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 |
|
| 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 |
|
| 1388 |
|
| 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 |
|
| 1403 |
} while (delta >= 1); |
| 1404 |
} finally { |
| 1405 |
LEAVING("2i22bxgg5y7v5c5d40k5zppky","transpose"); |
| 1406 |
} |
| 1407 |
} |
| 1408 |
|
| 1409 |
|
| 1410 |
|
| 1411 |
|
| 1412 |
|
| 1413 |
|
| 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 |
|
| 1446 |
|
| 1447 |
|
| 1448 |
|
| 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 |
|
| 1484 |
|
| 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 |
|
| 1507 |
|
| 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 |
|
| 1523 |
|
| 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 |
|
| 1555 |
|
| 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 |
|
| 1562 |
merge_components(g); |
| 1563 |
|
| 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 |
|
| 1571 |
|
| 1572 |
|
| 1573 |
|
| 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 |
|
| 1589 |
|
| 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 |
|
| 1605 |
for (c = 1; c <= GD_n_cluster(g); c++) |
| 1606 |
rec_reset_vlists((ST_Agraph_s) GD_clust(g).get(c).getPtr()); |
| 1607 |
|
| 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 |
|
| 1625 |
|
| 1626 |
|
| 1627 |
} finally { |
| 1628 |
LEAVING("3cwiyyk1d1jkoo9iqwb5bge4x","cleanup2"); |
| 1629 |
} |
| 1630 |
} |
| 1631 |
|
| 1632 |
|
| 1633 |
|
| 1634 |
|
| 1635 |
|
| 1636 |
|
| 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 |
|
| 1659 |
|
| 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 |
|
| 1673 |
|
| 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 |
|
| 1695 |
|
| 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 |
|
| 1709 |
|
| 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 |
|
| 1731 |
|
| 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 |
|
| 1749 |
|
| 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 |
|
| 1766 |
|
| 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 |
|
| 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 |
|
| 1793 |
|
| 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"); |
| 1798 |
UNSUPPORTED("3pmsfb0uhqmy5u141c932dtn1"); |
| 1799 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 1800 |
UNSUPPORTED("apiu3v3f9zs9yrq8e25nd2rti"); |
| 1801 |
UNSUPPORTED("6yramhpyls8c6kexupyqip8oq"); |
| 1802 |
UNSUPPORTED("ci2zh69w6nhi0q816i1ixuy9k"); |
| 1803 |
UNSUPPORTED("7z5fb6iyowsosn1hiz7opeoc6"); |
| 1804 |
UNSUPPORTED("wqxqmv4he79njsw6r7sludv"); |
| 1805 |
UNSUPPORTED("8htor72y55gsejjdeh0e8gdrs"); |
| 1806 |
UNSUPPORTED("bjae04ek2s3o50399zti5a1jh"); |
| 1807 |
UNSUPPORTED("bqfhaopbxlwv8h4zfae1lhx6s"); |
| 1808 |
UNSUPPORTED("7wq24g054kmx3aw25vk5ksj4"); |
| 1809 |
UNSUPPORTED("do7v5atqor4gnpwgo18ibgjha"); |
| 1810 |
UNSUPPORTED("9fo44dng5uojukw2kj0z8vvdu"); |
| 1811 |
UNSUPPORTED("emlgvc6yzuboae72y6vxpn8z7"); |
| 1812 |
UNSUPPORTED("d3fd9x50ix980jjw3old2jrcr"); |
| 1813 |
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); |
| 1814 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1815 |
UNSUPPORTED("7gfo0rr0un3w2026kt6ipknty"); |
| 1816 |
UNSUPPORTED("6mjvdb94lywg8d7ui6873f18p"); |
| 1817 |
UNSUPPORTED("8g0zxrf8w2zly4wln02j3lbnb"); |
| 1818 |
UNSUPPORTED("eqx93butvb7swnxbz9j29winp"); |
| 1819 |
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); |
| 1820 |
UNSUPPORTED("9h7suegjozc071a939rh9apw1"); |
| 1821 |
UNSUPPORTED("8kclviftszfxkowsmlqq31u8"); |
| 1822 |
UNSUPPORTED("8wiry1vcdwy6bzdp98nmxss7c"); |
| 1823 |
UNSUPPORTED("dy16sxtk3jj6127wavfcdx4yw"); |
| 1824 |
UNSUPPORTED("6jr3li9af4sp0uxnpnoe8dqh8"); |
| 1825 |
UNSUPPORTED("c47fetnb62mx46qzuk9ag3qmu"); |
| 1826 |
UNSUPPORTED("899cyghezv8oxs0iomu58zncj"); |
| 1827 |
UNSUPPORTED("btfqtg58rqwdh7o4cc0gbaaai"); |
| 1828 |
UNSUPPORTED("9zap4z819hsiogrgmekh15f00"); |
| 1829 |
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); |
| 1830 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 1831 |
UNSUPPORTED("1jw141gg4omv8r72xcbl5ln0o"); |
| 1832 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 1833 |
|
| 1834 |
throw new UnsupportedOperationException(); |
| 1835 |
} finally { |
| 1836 |
LEAVING("pv0rbbdopo4hmkbl5916qys1","realFillRanks"); |
| 1837 |
} |
| 1838 |
} |
| 1839 |
|
| 1840 |
|
| 1841 |
|
| 1842 |
|
| 1843 |
|
| 1844 |
|
| 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 |
|
| 1862 |
|
| 1863 |
public static void init_mincross(ST_Agraph_s g) { |
| 1864 |
ENTERING("7fy4chyk12o7bgp1rv3h27yl3","init_mincross"); |
| 1865 |
try { |
| 1866 |
int size; |
| 1867 |
|
| 1868 |
|
| 1869 |
Z.z().ReMincross = false; |
| 1870 |
Z.z().Root = g; |
| 1871 |
|
| 1872 |
|
| 1873 |
|
| 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 |
|
| 1895 |
|
| 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 |
|
| 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 |
|
| 1934 |
|
| 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 |
|
| 1979 |
|
| 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 |
|
| 2015 |
|
| 2016 |
public static void allocate_ranks(ST_Agraph_s g) { |
| 2017 |
ENTERING("d5vb6jiw8mhkaa8gjwn4eqfyn","allocate_ranks"); |
| 2018 |
try { |
| 2019 |
|
| 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 |
|
| 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 |
|
| 2058 |
|
| 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"); |
| 2067 |
UNSUPPORTED("53h8d82ax23hys2k21hjswp72"); |
| 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 |
|
| 2074 |
if (ND_order(n) > GD_rank(Z.z().Root).get(r).an) { |
| 2075 |
UNSUPPORTED("399szcw1txekt1xssyw7s2x07"); |
| 2076 |
UNSUPPORTED("9puojrmsk6vb1qc0jtr8ge4g8"); |
| 2077 |
return; |
| 2078 |
} |
| 2079 |
if ((r < GD_minrank(g)) || (r > GD_maxrank(g))) { |
| 2080 |
UNSUPPORTED("7o1thnqda767wqpe2lh9mj03t"); |
| 2081 |
UNSUPPORTED("d2ugluzf7bmj7osicgitgy3sr"); |
| 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"); |
| 2087 |
UNSUPPORTED("3qe3qpw5h6vse39xs1ca9sjmo"); |
| 2088 |
return; |
| 2089 |
} |
| 2090 |
} finally { |
| 2091 |
LEAVING("3lxoqxhiri9fgt20zc5jz3aa5","install_in_rank"); |
| 2092 |
} |
| 2093 |
} |
| 2094 |
|
| 2095 |
|
| 2096 |
|
| 2097 |
|
| 2098 |
|
| 2099 |
|
| 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"); |
| 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 |
|
| 2154 |
|
| 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 |
|
| 2186 |
|
| 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 |
|
| 2203 |
|
| 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 |
|
| 2229 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 2303 |
} |
| 2304 |
|
| 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 |
|
| 2318 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 2378 |
|
| 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 |
} |
| 2392 |
else { |
| 2393 |
r = 1; |
| 2394 |
dir = 1; |
| 2395 |
} |
| 2396 |
if (pass % 2 == 0) { |
| 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 { |
| 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 |
|
| 2424 |
|
| 2425 |
public static int local_cross(final ST_elist l, int dir) { |
| 2426 |
|
| 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"); |
| 2433 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 2434 |
UNSUPPORTED("2gmuwkiycm22in3d9obd7bzll"); |
| 2435 |
UNSUPPORTED("bcforqedbns82qhgqkocjbvm"); |
| 2436 |
UNSUPPORTED("9b48a157azcrz2ihzqehhpsvs"); |
| 2437 |
UNSUPPORTED("8az9seos08f2sa39127q6yo9"); |
| 2438 |
UNSUPPORTED("8xj2loay6suplxyiun7hlye39"); |
| 2439 |
UNSUPPORTED("div10atae09n36x269sl208r1"); |
| 2440 |
UNSUPPORTED("56xhe3qw67sg923dvr87k8hho"); |
| 2441 |
UNSUPPORTED("16t717mqlhfn3egmgor8are83"); |
| 2442 |
UNSUPPORTED("3lbek06034x2gsimhxwfmgf0r"); |
| 2443 |
UNSUPPORTED("2pkmgz4cm8lwpwxgcg3znjm90"); |
| 2444 |
UNSUPPORTED("8wj6phwqlmunjcua9abo6093d"); |
| 2445 |
UNSUPPORTED("pt12knuv94kokmtrwpdp1m0j"); |
| 2446 |
UNSUPPORTED("bw8rwv11yqzss88pad7ljil8a"); |
| 2447 |
UNSUPPORTED("6to1esmb8qfrhzgtr7jdqleja"); |
| 2448 |
UNSUPPORTED("2pkmgz4cm8lwpwxgcg3znjm90"); |
| 2449 |
UNSUPPORTED("bza83c6rmihrkzyllwf0jm4tn"); |
| 2450 |
UNSUPPORTED("csrxg0y1azmvde7t833lm13sp"); |
| 2451 |
UNSUPPORTED("bw8rwv11yqzss88pad7ljil8a"); |
| 2452 |
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); |
| 2453 |
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); |
| 2454 |
UNSUPPORTED("8dm5o3tsfvxtjilyob6q5ndi1"); |
| 2455 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 2456 |
|
| 2457 |
throw new UnsupportedOperationException(); |
| 2458 |
} finally { |
| 2459 |
LEAVING("aq18oa4k4grixvfjx7r2qnl6r","local_cross"); |
| 2460 |
} |
| 2461 |
} |
| 2462 |
|
| 2463 |
|
| 2464 |
|
| 2465 |
|
| 2466 |
|
| 2467 |
|
| 2468 |
|
| 2469 |
|
| 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 |
|
| 2520 |
|
| 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 |
|
| 2547 |
|
| 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 |
|
| 2561 |
|
| 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 |
|
| 2600 |
|
| 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 |
|
| 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 |
|
| 2670 |
|
| 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 |
|
| 2684 |
|
| 2685 |
public static Object edgeidcmpf(Object... arg) { |
| 2686 |
UNSUPPORTED("apvyql25ya1p7w7i7396gucdg"); |
| 2687 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 2688 |
UNSUPPORTED("9gjc2rit3ezq4il0t5aymk1z"); |
| 2689 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 2690 |
|
| 2691 |
throw new UnsupportedOperationException(); |
| 2692 |
} |
| 2693 |
|
| 2694 |
|
| 2695 |
|
| 2696 |
|
| 2697 |
private static int table[][] = new int[][]{ |
| 2698 |
{1, 1, 1}, |
| 2699 |
{1, 2, 2}, |
| 2700 |
{1, 2, 4} |
| 2701 |
}; |
| 2702 |
|
| 2703 |
|
| 2704 |
|
| 2705 |
|
| 2706 |
|
| 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 |
|
| 2724 |
|
| 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 |
|
| 2740 |
|
| 2741 |
public static void mincross_options(ST_Agraph_s g) { |
| 2742 |
ENTERING("7ru09oqbudpeofsthzveig2m2","mincross_options"); |
| 2743 |
try { |
| 2744 |
CString p; |
| 2745 |
double f; |
| 2746 |
|
| 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"); |
| 2753 |
UNSUPPORTED("38po81l36cibw6jc3qlsscpcu"); |
| 2754 |
} |
| 2755 |
} finally { |
| 2756 |
LEAVING("7ru09oqbudpeofsthzveig2m2","mincross_options"); |
| 2757 |
} |
| 2758 |
} |
| 2759 |
|
| 2760 |
|
| 2761 |
} |