@knowvah/dot-engine 2.9.0 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/graph-init.d.ts.map +1 -1
- package/dist/common/htmltable.d.ts +1 -1
- package/dist/common/htmltable.d.ts.map +1 -1
- package/dist/common/poly-init.d.ts +8 -8
- package/dist/common/poly-init.d.ts.map +1 -1
- package/dist/common/safefile.d.ts +15 -0
- package/dist/common/safefile.d.ts.map +1 -1
- package/dist/gvc/context.d.ts +7 -1
- package/dist/gvc/context.d.ts.map +1 -1
- package/dist/gvc/device.d.ts +2 -3
- package/dist/gvc/device.d.ts.map +1 -1
- package/dist/gvc/emit-xdot.d.ts +11 -0
- package/dist/gvc/emit-xdot.d.ts.map +1 -0
- package/dist/gvc/image-resolver.d.ts +5 -0
- package/dist/gvc/image-resolver.d.ts.map +1 -1
- package/dist/gvc/init-xdot.d.ts +7 -0
- package/dist/gvc/init-xdot.d.ts.map +1 -0
- package/dist/gvc/landscape.d.ts +11 -0
- package/dist/gvc/landscape.d.ts.map +1 -0
- package/dist/gvc/layout-bb.d.ts +17 -0
- package/dist/gvc/layout-bb.d.ts.map +1 -0
- package/dist/gvc/layout-reset.d.ts +26 -0
- package/dist/gvc/layout-reset.d.ts.map +1 -0
- package/dist/gvc/viewport.d.ts +1 -10
- package/dist/gvc/viewport.d.ts.map +1 -1
- package/dist/index.js +2497 -1650
- package/dist/index.js.map +4 -4
- package/dist/layout/circo/blocks.d.ts +2 -0
- package/dist/layout/circo/blocks.d.ts.map +1 -1
- package/dist/layout/circo/blocktree.d.ts +6 -0
- package/dist/layout/circo/blocktree.d.ts.map +1 -1
- package/dist/layout/circo/circular.d.ts +6 -0
- package/dist/layout/circo/circular.d.ts.map +1 -1
- package/dist/layout/dot/edge-route-rank.d.ts +34 -0
- package/dist/layout/dot/edge-route-rank.d.ts.map +1 -1
- package/dist/layout/dot/index.d.ts.map +1 -1
- package/dist/layout/dot/init.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat-labeled.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat-multi.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat.d.ts +1 -2
- package/dist/layout/dot/splines-flat.d.ts.map +1 -1
- package/dist/layout/dot/splines.d.ts +2 -2
- package/dist/layout/dot/splines.d.ts.map +1 -1
- package/dist/layout/neato/__fixtures__/kk-models.d.ts +59 -0
- package/dist/layout/neato/__fixtures__/kk-models.d.ts.map +1 -0
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.d.ts +12 -0
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.d.ts.map +1 -0
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc.d.ts +6 -0
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc.d.ts.map +1 -1
- package/dist/layout/neato/circuit.d.ts +38 -0
- package/dist/layout/neato/circuit.d.ts.map +1 -1
- package/dist/layout/neato/constrained-majorization.d.ts.map +1 -1
- package/dist/layout/neato/dijkstra.d.ts +7 -0
- package/dist/layout/neato/dijkstra.d.ts.map +1 -1
- package/dist/layout/neato/index.d.ts +6 -3
- package/dist/layout/neato/index.d.ts.map +1 -1
- package/dist/layout/neato/init.d.ts.map +1 -1
- package/dist/layout/neato/kk-paths.d.ts +11 -1
- package/dist/layout/neato/kk-paths.d.ts.map +1 -1
- package/dist/layout/neato/kk-solve.d.ts.map +1 -1
- package/dist/layout/neato/kk.d.ts +5 -3
- package/dist/layout/neato/kk.d.ts.map +1 -1
- package/dist/layout/neato/kkutils.d.ts +45 -0
- package/dist/layout/neato/kkutils.d.ts.map +1 -1
- package/dist/layout/neato/splines.d.ts +7 -3
- package/dist/layout/neato/splines.d.ts.map +1 -1
- package/dist/layout/neato/start.d.ts +11 -10
- package/dist/layout/neato/start.d.ts.map +1 -1
- package/dist/layout/neato/stress-models.d.ts +25 -19
- package/dist/layout/neato/stress-models.d.ts.map +1 -1
- package/dist/layout/pack/ccomps.d.ts +32 -0
- package/dist/layout/pack/ccomps.d.ts.map +1 -0
- package/dist/layout/pack/index.d.ts +1 -24
- package/dist/layout/pack/index.d.ts.map +1 -1
- package/dist/layout/sfdp/init.d.ts.map +1 -1
- package/dist/render/dot/write-back.d.ts +37 -0
- package/dist/render/dot/write-back.d.ts.map +1 -0
- package/dist/render/dot.d.ts +5 -7
- package/dist/render/dot.d.ts.map +1 -1
- package/dist/render/json.d.ts +16 -21
- package/dist/render/json.d.ts.map +1 -1
- package/dist/render.js +2899 -2052
- package/dist/render.js.map +4 -4
- package/dist/util/libcxx-sort.d.ts +7 -0
- package/dist/util/libcxx-sort.d.ts.map +1 -0
- package/dist/vpsc/SweepLine.d.ts +23 -10
- package/dist/vpsc/SweepLine.d.ts.map +1 -1
- package/dist/vpsc/sweepTypes.d.ts +12 -2
- package/dist/vpsc/sweepTypes.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/graph-init.ts +5 -1
- package/src/common/htmltable.ts +6 -4
- package/src/common/poly-init.ts +35 -15
- package/src/common/safefile.ts +20 -2
- package/src/gvc/__fixtures__/p8/bad.png +1 -0
- package/src/gvc/__fixtures__/p8/d/r.png +0 -0
- package/src/gvc/__fixtures__/p8/html-img-bad.gv +1 -0
- package/src/gvc/__fixtures__/p8/html-img-bad.svg +19 -0
- package/src/gvc/__fixtures__/p8/html-img-bad.svg.stderr +3 -0
- package/src/gvc/__fixtures__/p8/html-img-bad.xdot +13 -0
- package/src/gvc/__fixtures__/p8/html-img-bad.xdot.stderr +3 -0
- package/src/gvc/__fixtures__/p8/ip-shapefile.gv +1 -0
- package/src/gvc/__fixtures__/p8/ip-shapefile.svg +19 -0
- package/src/gvc/__fixtures__/p8/ip-shapefile.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p8/ip-shapefile.xdot +15 -0
- package/src/gvc/__fixtures__/p8/ip-shapefile.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p8/regen.sh +13 -0
- package/src/gvc/__fixtures__/replay-native.json +422 -0
- package/src/gvc/__fixtures__/rerender/background.dot.seq-xdot-svg.1 +25 -0
- package/src/gvc/__fixtures__/rerender/background.dot.seq-xdot-svg.2 +37 -0
- package/src/gvc/__fixtures__/rerender/background.gv +1 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.xdot.1 +25 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.xdot.2 +25 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.gv +1 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.plain.1 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.plain.2 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-dot-dot.1 +18 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-dot-dot.2 +18 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-plain-xdot.1 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-plain-xdot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-dot.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-dot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-plain.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-plain.2 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-svg.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-svg.2 +46 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-then-svg.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-then-svg.2 +47 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-xdot.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-xdot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.xdot.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.xdot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.gv +1 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-circo.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-fdp.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-neato.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-dot-dot.1 +11 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-dot-dot.2 +11 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-json-json.1 +148 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-json-json.2 +162 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-plain-xdot.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-plain-xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-dot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-dot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-plain.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-svg.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-svg.2 +30 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-then-svg.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-then-svg.2 +31 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.xdot.2 +21 -0
- package/src/gvc/__fixtures__/rerender/filing.gv +1 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.seq-xdot-then-svg.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.seq-xdot-then-svg.2 +31 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.xdot.2 +21 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.xdot.1 +103 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.xdot.2 +104 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-dot-dot.1 +75 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-dot-dot.2 +75 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-plain-xdot.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-plain-xdot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-dot.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-dot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-plain.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-svg.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-svg.2 +127 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-then-svg.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-then-svg.2 +128 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-xdot.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-xdot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.xdot.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.xdot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.fdp.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.fdp.xdot.1 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.gv +8 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.xdot.1 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.xdot.2 +118 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.xdot.1 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.xdot.2 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.xdot.1 +78 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.xdot.2 +79 -0
- package/src/gvc/__fixtures__/rerender/mixed.sfdp.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.sfdp.xdot.1 +103 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.xdot.1 +103 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.xdot.2 +103 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.1 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.2 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.3 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.1 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.2 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.3 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.gv +16 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.1 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.2 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.3 +29 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.gv +1 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-dot-plain.1 +34 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-dot-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json-plain.1 +471 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json0-plain.1 +121 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json0-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-xdot-plain.1 +60 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-xdot-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/regen.sh +81 -0
- package/src/gvc/__fixtures__/rerender/sized-clip.gv +18 -0
- package/src/gvc/__fixtures__/rerender/sized-clip.neato.xdot.1 +86 -0
- package/src/gvc/__fixtures__/rerender/sized-clip.neato.xdot.2 +86 -0
- package/src/gvc/context.ts +13 -1
- package/src/gvc/device.ts +6 -6
- package/src/gvc/emit-xdot.ts +208 -0
- package/src/gvc/image-resolver.ts +8 -0
- package/src/gvc/init-xdot.ts +36 -0
- package/src/gvc/landscape.ts +36 -0
- package/src/gvc/layout-bb.ts +43 -0
- package/src/gvc/layout-reset.ts +62 -0
- package/src/gvc/viewport.ts +1 -32
- package/src/layout/circo/__fixtures__/root/both-connected.gv +11 -0
- package/src/layout/circo/__fixtures__/root/both-connected.xdot +53 -0
- package/src/layout/circo/__fixtures__/root/both-connected.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/both-per-component.gv +18 -0
- package/src/layout/circo/__fixtures__/root/both-per-component.xdot +97 -0
- package/src/layout/circo/__fixtures__/root/both-per-component.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-none-node.gv +11 -0
- package/src/layout/circo/__fixtures__/root/graph-none-node.xdot +53 -0
- package/src/layout/circo/__fixtures__/root/graph-none-node.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-first.gv +17 -0
- package/src/layout/circo/__fixtures__/root/graph-root-first.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/graph-root-first.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-later.gv +17 -0
- package/src/layout/circo/__fixtures__/root/graph-root-later.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/graph-root-later.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-none.gv +17 -0
- package/src/layout/circo/__fixtures__/root/graph-root-none.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/graph-root-none.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-paths.gv +7 -0
- package/src/layout/circo/__fixtures__/root/graph-root-paths.xdot +46 -0
- package/src/layout/circo/__fixtures__/root/graph-root-paths.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/no-root-connected.gv +9 -0
- package/src/layout/circo/__fixtures__/root/no-root-connected.xdot +51 -0
- package/src/layout/circo/__fixtures__/root/no-root-connected.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/no-root.gv +16 -0
- package/src/layout/circo/__fixtures__/root/no-root.xdot +95 -0
- package/src/layout/circo/__fixtures__/root/no-root.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-connected.gv +10 -0
- package/src/layout/circo/__fixtures__/root/node-root-connected.xdot +52 -0
- package/src/layout/circo/__fixtures__/root/node-root-connected.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-false.gv +10 -0
- package/src/layout/circo/__fixtures__/root/node-root-false.xdot +52 -0
- package/src/layout/circo/__fixtures__/root/node-root-false.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-later.gv +17 -0
- package/src/layout/circo/__fixtures__/root/node-root-later.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/node-root-later.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-two.gv +11 -0
- package/src/layout/circo/__fixtures__/root/node-root-two.xdot +53 -0
- package/src/layout/circo/__fixtures__/root/node-root-two.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/regen.sh +16 -0
- package/src/layout/circo/blocks.ts +3 -0
- package/src/layout/circo/blocktree.ts +17 -3
- package/src/layout/circo/circular.ts +13 -1
- package/src/layout/dot/edge-route-rank.ts +72 -0
- package/src/layout/dot/edge-route.ts +6 -6
- package/src/layout/dot/index.ts +2 -0
- package/src/layout/dot/init.ts +17 -5
- package/src/layout/dot/splines-flat-labeled.ts +2 -1
- package/src/layout/dot/splines-flat-multi.ts +2 -1
- package/src/layout/dot/splines-flat.ts +3 -3
- package/src/layout/dot/splines.ts +9 -9
- package/src/layout/neato/__fixtures__/kk-models.ts +82 -0
- package/src/layout/neato/__fixtures__/models/hier-circuit.gv +15 -0
- package/src/layout/neato/__fixtures__/models/hier-circuit.xdot +92 -0
- package/src/layout/neato/__fixtures__/models/hier-circuit.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/hier-default.gv +14 -0
- package/src/layout/neato/__fixtures__/models/hier-default.xdot +91 -0
- package/src/layout/neato/__fixtures__/models/hier-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/hier-disc-circuit.gv +9 -0
- package/src/layout/neato/__fixtures__/models/hier-disc-circuit.xdot +54 -0
- package/src/layout/neato/__fixtures__/models/hier-disc-circuit.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/hier-len-circuit.gv +15 -0
- package/src/layout/neato/__fixtures__/models/hier-len-circuit.xdot +97 -0
- package/src/layout/neato/__fixtures__/models/hier-len-circuit.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/hier-len-mds.gv +15 -0
- package/src/layout/neato/__fixtures__/models/hier-len-mds.xdot +97 -0
- package/src/layout/neato/__fixtures__/models/hier-len-mds.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/hier-len-subset.gv +15 -0
- package/src/layout/neato/__fixtures__/models/hier-len-subset.xdot +97 -0
- package/src/layout/neato/__fixtures__/models/hier-len-subset.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/hier-long-mds.gv +15 -0
- package/src/layout/neato/__fixtures__/models/hier-long-mds.xdot +95 -0
- package/src/layout/neato/__fixtures__/models/hier-long-mds.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/hier-mds-nolen.gv +15 -0
- package/src/layout/neato/__fixtures__/models/hier-mds-nolen.xdot +92 -0
- package/src/layout/neato/__fixtures__/models/hier-mds-nolen.xdot.stderr +2 -0
- package/src/layout/neato/__fixtures__/models/hier-pin-disc-circuit.gv +10 -0
- package/src/layout/neato/__fixtures__/models/hier-pin-disc-circuit.xdot +54 -0
- package/src/layout/neato/__fixtures__/models/hier-pin-disc-circuit.xdot.stderr +3 -0
- package/src/layout/neato/__fixtures__/models/hier-shortpath.gv +15 -0
- package/src/layout/neato/__fixtures__/models/hier-shortpath.xdot +92 -0
- package/src/layout/neato/__fixtures__/models/hier-shortpath.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/hier-subset.gv +15 -0
- package/src/layout/neato/__fixtures__/models/hier-subset.xdot +92 -0
- package/src/layout/neato/__fixtures__/models/hier-subset.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/kk-circuit.gv +15 -0
- package/src/layout/neato/__fixtures__/models/kk-circuit.xdot +81 -0
- package/src/layout/neato/__fixtures__/models/kk-circuit.xdot.stderr +4 -0
- package/src/layout/neato/__fixtures__/models/kk-default.gv +14 -0
- package/src/layout/neato/__fixtures__/models/kk-default.xdot +80 -0
- package/src/layout/neato/__fixtures__/models/kk-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/kk-disc-circuit-pack.gv +10 -0
- package/src/layout/neato/__fixtures__/models/kk-disc-circuit-pack.native-crash +1 -0
- package/src/layout/neato/__fixtures__/models/kk-disc-circuit-pack.xdot +0 -0
- package/src/layout/neato/__fixtures__/models/kk-disc-circuit-pack.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/kk-disc-circuit.gv +9 -0
- package/src/layout/neato/__fixtures__/models/kk-disc-circuit.xdot +49 -0
- package/src/layout/neato/__fixtures__/models/kk-disc-circuit.xdot.stderr +4 -0
- package/src/layout/neato/__fixtures__/models/kk-disc-shortpath-pack.gv +10 -0
- package/src/layout/neato/__fixtures__/models/kk-disc-shortpath-pack.xdot +50 -0
- package/src/layout/neato/__fixtures__/models/kk-disc-shortpath-pack.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/kk-disc4-circuit-pack.gv +13 -0
- package/src/layout/neato/__fixtures__/models/kk-disc4-circuit-pack.native-crash +1 -0
- package/src/layout/neato/__fixtures__/models/kk-disc4-circuit-pack.xdot +0 -0
- package/src/layout/neato/__fixtures__/models/kk-disc4-circuit-pack.xdot.stderr +4 -0
- package/src/layout/neato/__fixtures__/models/kk-disc4-shortpath-pack.gv +13 -0
- package/src/layout/neato/__fixtures__/models/kk-disc4-shortpath-pack.xdot +66 -0
- package/src/layout/neato/__fixtures__/models/kk-disc4-shortpath-pack.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-circuit.gv +11 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-circuit.xdot +51 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-circuit.xdot.stderr +4 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-len-circuit.gv +11 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-len-circuit.xdot +57 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-len-circuit.xdot.stderr +4 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-len-mds.gv +11 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-len-mds.xdot +57 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-len-mds.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-long-mds.gv +11 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-long-mds.xdot +57 -0
- package/src/layout/neato/__fixtures__/models/kk-iso-long-mds.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/kk-large.gv +203 -0
- package/src/layout/neato/__fixtures__/models/kk-large.pow.json +1088 -0
- package/src/layout/neato/__fixtures__/models/kk-large.xdot +1208 -0
- package/src/layout/neato/__fixtures__/models/kk-large.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/kk-len-circuit.gv +15 -0
- package/src/layout/neato/__fixtures__/models/kk-len-circuit.xdot +86 -0
- package/src/layout/neato/__fixtures__/models/kk-len-circuit.xdot.stderr +4 -0
- package/src/layout/neato/__fixtures__/models/kk-len-mds.gv +15 -0
- package/src/layout/neato/__fixtures__/models/kk-len-mds.xdot +86 -0
- package/src/layout/neato/__fixtures__/models/kk-len-mds.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/kk-len-subset.gv +15 -0
- package/src/layout/neato/__fixtures__/models/kk-len-subset.xdot +86 -0
- package/src/layout/neato/__fixtures__/models/kk-len-subset.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/kk-mds-nolen.gv +15 -0
- package/src/layout/neato/__fixtures__/models/kk-mds-nolen.xdot +81 -0
- package/src/layout/neato/__fixtures__/models/kk-mds-nolen.xdot.stderr +2 -0
- package/src/layout/neato/__fixtures__/models/kk-shortpath.gv +15 -0
- package/src/layout/neato/__fixtures__/models/kk-shortpath.xdot +81 -0
- package/src/layout/neato/__fixtures__/models/kk-shortpath.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/kk-subset.gv +15 -0
- package/src/layout/neato/__fixtures__/models/kk-subset.xdot +81 -0
- package/src/layout/neato/__fixtures__/models/kk-subset.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/large-circuit.gv +203 -0
- package/src/layout/neato/__fixtures__/models/large-circuit.xdot +1208 -0
- package/src/layout/neato/__fixtures__/models/large-circuit.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/major-circuit.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-circuit.xdot +80 -0
- package/src/layout/neato/__fixtures__/models/major-circuit.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/major-default.gv +13 -0
- package/src/layout/neato/__fixtures__/models/major-default.xdot +79 -0
- package/src/layout/neato/__fixtures__/models/major-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/major-disc-circuit.gv +8 -0
- package/src/layout/neato/__fixtures__/models/major-disc-circuit.xdot +48 -0
- package/src/layout/neato/__fixtures__/models/major-disc-circuit.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/major-len-circuit.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-len-circuit.xdot +85 -0
- package/src/layout/neato/__fixtures__/models/major-len-circuit.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/major-len-mds.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-len-mds.xdot +85 -0
- package/src/layout/neato/__fixtures__/models/major-len-mds.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/major-len-subset.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-len-subset.xdot +85 -0
- package/src/layout/neato/__fixtures__/models/major-len-subset.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/major-long-mds.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-long-mds.xdot +83 -0
- package/src/layout/neato/__fixtures__/models/major-long-mds.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/major-long-shortpath.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-long-shortpath.xdot +83 -0
- package/src/layout/neato/__fixtures__/models/major-long-shortpath.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/major-mds-edge-default.gv +15 -0
- package/src/layout/neato/__fixtures__/models/major-mds-edge-default.xdot +81 -0
- package/src/layout/neato/__fixtures__/models/major-mds-edge-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/major-mds-nolen-anon.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-mds-nolen-anon.xdot +80 -0
- package/src/layout/neato/__fixtures__/models/major-mds-nolen-anon.xdot.stderr +2 -0
- package/src/layout/neato/__fixtures__/models/major-mds-nolen.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-mds-nolen.xdot +80 -0
- package/src/layout/neato/__fixtures__/models/major-mds-nolen.xdot.stderr +2 -0
- package/src/layout/neato/__fixtures__/models/major-model-Subset.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-model-Subset.xdot +80 -0
- package/src/layout/neato/__fixtures__/models/major-model-Subset.xdot.stderr +1 -0
- package/src/layout/neato/__fixtures__/models/major-model-foo-anon.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-model-foo-anon.xdot +80 -0
- package/src/layout/neato/__fixtures__/models/major-model-foo-anon.xdot.stderr +1 -0
- package/src/layout/neato/__fixtures__/models/major-model-foo.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-model-foo.xdot +80 -0
- package/src/layout/neato/__fixtures__/models/major-model-foo.xdot.stderr +1 -0
- package/src/layout/neato/__fixtures__/models/major-pin-disc-circuit.gv +9 -0
- package/src/layout/neato/__fixtures__/models/major-pin-disc-circuit.xdot +48 -0
- package/src/layout/neato/__fixtures__/models/major-pin-disc-circuit.xdot.stderr +2 -0
- package/src/layout/neato/__fixtures__/models/major-shortpath.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-shortpath.xdot +80 -0
- package/src/layout/neato/__fixtures__/models/major-shortpath.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/major-subset.gv +14 -0
- package/src/layout/neato/__fixtures__/models/major-subset.xdot +80 -0
- package/src/layout/neato/__fixtures__/models/major-subset.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/models/regen.sh +46 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.xdot +115 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.xdot.stderr +3 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.gv +16 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.xdot +100 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.xdot +106 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/regen.sh +16 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.ts +14 -0
- package/src/layout/neato/__fixtures__/quad-prog-vpsc.ts +7 -1
- package/src/layout/neato/circuit.ts +67 -2
- package/src/layout/neato/constrained-majorization.ts +5 -22
- package/src/layout/neato/dijkstra.ts +12 -3
- package/src/layout/neato/index.ts +41 -14
- package/src/layout/neato/init.ts +9 -13
- package/src/layout/neato/kk-paths.ts +23 -1
- package/src/layout/neato/kk-solve.ts +5 -3
- package/src/layout/neato/kk.ts +53 -21
- package/src/layout/neato/kkutils.ts +108 -3
- package/src/layout/neato/splines.ts +18 -18
- package/src/layout/neato/start.ts +20 -65
- package/src/layout/neato/stress-models.ts +55 -59
- package/src/layout/pack/ccomps.ts +131 -0
- package/src/layout/pack/index.ts +1 -95
- package/src/layout/sfdp/__fixtures__/start-warning/regen.sh +16 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-5.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-5.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-5.xdot.stderr +0 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-random5.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-random5.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-random5.xdot.stderr +0 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-regular.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-regular.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-regular.xdot.stderr +1 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.gv +16 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.xdot +78 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.xdot.stderr +2 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self.xdot.stderr +1 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-unset.gv +14 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-unset.xdot +76 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-unset.xdot.stderr +0 -0
- package/src/layout/sfdp/index.ts +1 -1
- package/src/layout/sfdp/init.ts +9 -1
- package/src/layout/twopi/index.ts +1 -1
- package/src/render/dot/agwrite.ts +1 -1
- package/src/render/dot/write-back.ts +137 -0
- package/src/render/dot.ts +12 -12
- package/src/render/json.ts +34 -34
- package/src/util/libcxx-sort.ts +461 -0
- package/src/vpsc/SweepLine.ts +50 -38
- package/src/vpsc/sweepTypes.ts +13 -2
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* In-place sort matching libc++ `std::sort`'s permutation, including its treatment of
|
|
5
|
+
* comparator-equal elements. Ported from LLVM libc++ (`_LIBCPP_VERSION` 220106), which is
|
|
6
|
+
* permissively licensed and EPL-2.0-compatible:
|
|
7
|
+
*
|
|
8
|
+
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
9
|
+
* See https://llvm.org/LICENSE.txt for license information.
|
|
10
|
+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
11
|
+
*
|
|
12
|
+
* Source: `__algorithm/sort.h`, `sift_down.h`, `make_heap.h`, `partial_sort.h`, `sort_heap.h`,
|
|
13
|
+
* `pop_heap.h`, `push_heap.h`.
|
|
14
|
+
*
|
|
15
|
+
* Why: lib/vpsc/generate-constraints.cpp sorts sweep events with `std::sort`. Its comparator
|
|
16
|
+
* reports a tie for different rectangles at one position, and libc++ reorders ties repeatably,
|
|
17
|
+
* so JS's stable sort gives another event order from 24 rectangles up (48 events, the first
|
|
18
|
+
* length above `__limit`). See plans/post-16-1-followups-9/harness/T7.
|
|
19
|
+
*
|
|
20
|
+
* This is the one instantiation the oracle's libvpsc.a holds, whose mangled names read
|
|
21
|
+
* `__introsort<_ClassicAlgPolicy, bool (*&)(const Event&, const Event&), Event*, false>` and
|
|
22
|
+
* `__sift_down<_ClassicAlgPolicy, false, ...>`: a type that is not arithmetic and so not
|
|
23
|
+
* branchless. What that instantiation cannot reach is not ported: the branchless `__sort3-5`,
|
|
24
|
+
* `__bitset_partition`, `__sift_down`'s `__assume_both_children`, and `__partial_sort_impl`'s
|
|
25
|
+
* loop over `[middle, last)`, because the fallback passes `middle == last`.
|
|
26
|
+
*
|
|
27
|
+
* Moved-from slots keep their old value here. No path reads one before it is written, as in C++.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** Upper bound for using insertion sort. @see __algorithm/sort.h:__introsort __limit */
|
|
31
|
+
const LIMIT = 24;
|
|
32
|
+
/** Lower bound for Tukey's ninther. @see __algorithm/sort.h:__introsort __ninther_threshold */
|
|
33
|
+
const NINTHER_THRESHOLD = 128;
|
|
34
|
+
/** Insertions before giving up. @see __algorithm/sort.h:__insertion_sort_incomplete __limit */
|
|
35
|
+
const INCOMPLETE_LIMIT = 8;
|
|
36
|
+
|
|
37
|
+
/** @see __bit/bit_log2.h:__bit_log2 */
|
|
38
|
+
function bitLog2(n: number): number {
|
|
39
|
+
return 31 - Math.clz32(n);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The template's fixed arguments, the array and the comparator, as fields. Indices stand for the
|
|
44
|
+
* C++ iterators.
|
|
45
|
+
*/
|
|
46
|
+
class Introsort<T> {
|
|
47
|
+
private readonly a: T[];
|
|
48
|
+
private readonly lt: (x: T, y: T) => boolean;
|
|
49
|
+
|
|
50
|
+
constructor(a: T[], lt: (x: T, y: T) => boolean) {
|
|
51
|
+
this.a = a;
|
|
52
|
+
this.lt = lt;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** @see __algorithm/iter_swap.h:iter_swap */
|
|
56
|
+
private swap(i: number, j: number): void {
|
|
57
|
+
const a = this.a;
|
|
58
|
+
const t = a[i]!;
|
|
59
|
+
a[i] = a[j]!;
|
|
60
|
+
a[j] = t;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** @see __algorithm/sort.h:__sort3 */
|
|
64
|
+
private sort3(x: number, y: number, z: number): void {
|
|
65
|
+
const { a, lt } = this;
|
|
66
|
+
if (!lt(a[y]!, a[x]!)) {
|
|
67
|
+
if (!lt(a[z]!, a[y]!)) return;
|
|
68
|
+
this.swap(y, z);
|
|
69
|
+
if (lt(a[y]!, a[x]!)) this.swap(x, y);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (lt(a[z]!, a[y]!)) {
|
|
73
|
+
this.swap(x, z);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.swap(x, y);
|
|
77
|
+
if (lt(a[z]!, a[y]!)) this.swap(y, z);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** @see __algorithm/sort.h:__sort4 */
|
|
81
|
+
private sort4(x1: number, x2: number, x3: number, x4: number): void {
|
|
82
|
+
const { a, lt } = this;
|
|
83
|
+
this.sort3(x1, x2, x3);
|
|
84
|
+
if (lt(a[x4]!, a[x3]!)) {
|
|
85
|
+
this.swap(x3, x4);
|
|
86
|
+
if (lt(a[x3]!, a[x2]!)) {
|
|
87
|
+
this.swap(x2, x3);
|
|
88
|
+
if (lt(a[x2]!, a[x1]!)) this.swap(x1, x2);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** @see __algorithm/sort.h:__sort5 */
|
|
94
|
+
private sort5(x1: number, x2: number, x3: number, x4: number, x5: number): void {
|
|
95
|
+
const { a, lt } = this;
|
|
96
|
+
this.sort4(x1, x2, x3, x4);
|
|
97
|
+
if (lt(a[x5]!, a[x4]!)) {
|
|
98
|
+
this.swap(x4, x5);
|
|
99
|
+
if (lt(a[x4]!, a[x3]!)) {
|
|
100
|
+
this.swap(x3, x4);
|
|
101
|
+
if (lt(a[x3]!, a[x2]!)) {
|
|
102
|
+
this.swap(x2, x3);
|
|
103
|
+
if (lt(a[x2]!, a[x1]!)) this.swap(x1, x2);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The `switch (__last - __first)` that `__introsort` and `__insertion_sort_incomplete` share
|
|
111
|
+
* word for word, as one function because of the project's complexity limit.
|
|
112
|
+
* @returns true when the length was one of the cases, so the range is sorted
|
|
113
|
+
* @see __algorithm/sort.h:__introsort
|
|
114
|
+
*/
|
|
115
|
+
private sortSmall(first: number, last: number): boolean {
|
|
116
|
+
const { a, lt } = this;
|
|
117
|
+
switch (last - first) {
|
|
118
|
+
case 0:
|
|
119
|
+
case 1:
|
|
120
|
+
return true;
|
|
121
|
+
case 2:
|
|
122
|
+
if (lt(a[last - 1]!, a[first]!)) this.swap(first, last - 1);
|
|
123
|
+
return true;
|
|
124
|
+
case 3:
|
|
125
|
+
this.sort3(first, first + 1, last - 1);
|
|
126
|
+
return true;
|
|
127
|
+
case 4:
|
|
128
|
+
this.sort4(first, first + 1, first + 2, last - 1);
|
|
129
|
+
return true;
|
|
130
|
+
case 5:
|
|
131
|
+
this.sort5(first, first + 1, first + 2, first + 3, last - 1);
|
|
132
|
+
return true;
|
|
133
|
+
default:
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** @see __algorithm/sort.h:__insertion_sort */
|
|
139
|
+
private insertionSort(first: number, last: number): void {
|
|
140
|
+
const { a, lt } = this;
|
|
141
|
+
if (first === last) return;
|
|
142
|
+
for (let i = first + 1; i !== last; ++i) {
|
|
143
|
+
let j = i - 1;
|
|
144
|
+
if (lt(a[i]!, a[j]!)) {
|
|
145
|
+
const t = a[i]!;
|
|
146
|
+
let k = j;
|
|
147
|
+
j = i;
|
|
148
|
+
do {
|
|
149
|
+
a[j] = a[k]!;
|
|
150
|
+
j = k;
|
|
151
|
+
} while (j !== first && lt(t, a[--k]!));
|
|
152
|
+
a[j] = t;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Assumes that `first - 1` holds an element no element of the range sorts before.
|
|
159
|
+
* @see __algorithm/sort.h:__insertion_sort_unguarded
|
|
160
|
+
*/
|
|
161
|
+
private insertionSortUnguarded(first: number, last: number): void {
|
|
162
|
+
const { a, lt } = this;
|
|
163
|
+
if (first === last) return;
|
|
164
|
+
for (let i = first + 1; i !== last; ++i) {
|
|
165
|
+
let j = i - 1;
|
|
166
|
+
if (lt(a[i]!, a[j]!)) {
|
|
167
|
+
const t = a[i]!;
|
|
168
|
+
let k = j;
|
|
169
|
+
j = i;
|
|
170
|
+
do {
|
|
171
|
+
a[j] = a[k]!;
|
|
172
|
+
j = k;
|
|
173
|
+
} while (lt(t, a[--k]!));
|
|
174
|
+
a[j] = t;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** @see __algorithm/sort.h:__insertion_sort_incomplete */
|
|
180
|
+
private insertionSortIncomplete(first: number, last: number): boolean {
|
|
181
|
+
const { a, lt } = this;
|
|
182
|
+
if (this.sortSmall(first, last)) return true;
|
|
183
|
+
let j = first + 2;
|
|
184
|
+
this.sort3(first, first + 1, j);
|
|
185
|
+
let count = 0;
|
|
186
|
+
for (let i = j + 1; i !== last; ++i) {
|
|
187
|
+
if (lt(a[i]!, a[j]!)) {
|
|
188
|
+
const t = a[i]!;
|
|
189
|
+
let k = j;
|
|
190
|
+
j = i;
|
|
191
|
+
do {
|
|
192
|
+
a[j] = a[k]!;
|
|
193
|
+
j = k;
|
|
194
|
+
} while (j !== first && lt(t, a[--k]!));
|
|
195
|
+
a[j] = t;
|
|
196
|
+
if (++count === INCOMPLETE_LIMIT) return ++i === last;
|
|
197
|
+
}
|
|
198
|
+
j = i;
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* `*first` holds the pivot. Elements equivalent to it end up on its right.
|
|
205
|
+
* @returns the pivot's index, and whether the range was already partitioned
|
|
206
|
+
* @see __algorithm/sort.h:__partition_with_equals_on_right
|
|
207
|
+
*/
|
|
208
|
+
private partitionWithEqualsOnRight(first: number, last: number): [number, boolean] {
|
|
209
|
+
const { a, lt } = this;
|
|
210
|
+
const begin = first;
|
|
211
|
+
const pivot = a[first]!;
|
|
212
|
+
do {
|
|
213
|
+
++first;
|
|
214
|
+
} while (lt(a[first]!, pivot));
|
|
215
|
+
if (begin === first - 1) {
|
|
216
|
+
while (first < last && !lt(a[--last]!, pivot));
|
|
217
|
+
} else {
|
|
218
|
+
do {
|
|
219
|
+
--last;
|
|
220
|
+
} while (!lt(a[last]!, pivot));
|
|
221
|
+
}
|
|
222
|
+
const alreadyPartitioned = first >= last;
|
|
223
|
+
while (first < last) {
|
|
224
|
+
this.swap(first, last);
|
|
225
|
+
do {
|
|
226
|
+
++first;
|
|
227
|
+
} while (lt(a[first]!, pivot));
|
|
228
|
+
do {
|
|
229
|
+
--last;
|
|
230
|
+
} while (!lt(a[last]!, pivot));
|
|
231
|
+
}
|
|
232
|
+
const pivotPos = first - 1;
|
|
233
|
+
if (begin !== pivotPos) a[begin] = a[pivotPos]!;
|
|
234
|
+
a[pivotPos] = pivot;
|
|
235
|
+
return [pivotPos, alreadyPartitioned];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* The opening scan of `__partition_with_equals_on_left`, apart because of the project's
|
|
240
|
+
* complexity limit.
|
|
241
|
+
* @returns the first index after `first` that sorts after the pivot, or `last`
|
|
242
|
+
* @see __algorithm/sort.h:__partition_with_equals_on_left
|
|
243
|
+
*/
|
|
244
|
+
private firstAfterPivot(first: number, last: number, pivot: T): number {
|
|
245
|
+
const { a, lt } = this;
|
|
246
|
+
if (lt(pivot, a[last - 1]!)) {
|
|
247
|
+
do {
|
|
248
|
+
++first;
|
|
249
|
+
} while (!lt(pivot, a[first]!));
|
|
250
|
+
} else {
|
|
251
|
+
while (++first < last && !lt(pivot, a[first]!));
|
|
252
|
+
}
|
|
253
|
+
return first;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* `*first` holds the pivot. Elements equivalent to it end up on its left.
|
|
258
|
+
* @returns the index after the pivot
|
|
259
|
+
* @see __algorithm/sort.h:__partition_with_equals_on_left
|
|
260
|
+
*/
|
|
261
|
+
private partitionWithEqualsOnLeft(first: number, last: number): number {
|
|
262
|
+
const { a, lt } = this;
|
|
263
|
+
const begin = first;
|
|
264
|
+
const pivot = a[first]!;
|
|
265
|
+
first = this.firstAfterPivot(first, last, pivot);
|
|
266
|
+
if (first < last) {
|
|
267
|
+
do {
|
|
268
|
+
--last;
|
|
269
|
+
} while (lt(pivot, a[last]!));
|
|
270
|
+
}
|
|
271
|
+
while (first < last) {
|
|
272
|
+
this.swap(first, last);
|
|
273
|
+
do {
|
|
274
|
+
++first;
|
|
275
|
+
} while (!lt(pivot, a[first]!));
|
|
276
|
+
do {
|
|
277
|
+
--last;
|
|
278
|
+
} while (lt(pivot, a[last]!));
|
|
279
|
+
}
|
|
280
|
+
const pivotPos = first - 1;
|
|
281
|
+
if (begin !== pivotPos) a[begin] = a[pivotPos]!;
|
|
282
|
+
a[pivotPos] = pivot;
|
|
283
|
+
return first;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** @see __algorithm/sift_down.h:__sift_down */
|
|
287
|
+
private siftDown(first: number, len: number, start: number): void {
|
|
288
|
+
const { a, lt } = this;
|
|
289
|
+
let child = start;
|
|
290
|
+
if (len < 2 || Math.trunc((len - 2) / 2) < child) return;
|
|
291
|
+
child = 2 * child + 1;
|
|
292
|
+
if (child + 1 < len && lt(a[first + child]!, a[first + child + 1]!)) ++child;
|
|
293
|
+
if (lt(a[first + child]!, a[first + start]!)) return;
|
|
294
|
+
const top = a[first + start]!;
|
|
295
|
+
do {
|
|
296
|
+
a[first + start] = a[first + child]!;
|
|
297
|
+
start = child;
|
|
298
|
+
if (Math.trunc((len - 2) / 2) < child) break;
|
|
299
|
+
child = 2 * child + 1;
|
|
300
|
+
if (child + 1 < len && lt(a[first + child]!, a[first + child + 1]!)) ++child;
|
|
301
|
+
} while (!lt(a[first + child]!, top));
|
|
302
|
+
a[first + start] = top;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** @see __algorithm/sift_down.h:__floyd_sift_down */
|
|
306
|
+
private floydSiftDown(first: number, len: number): number {
|
|
307
|
+
const { a, lt } = this;
|
|
308
|
+
let hole = first;
|
|
309
|
+
let childI = first;
|
|
310
|
+
let child = 0;
|
|
311
|
+
while (true) {
|
|
312
|
+
childI += child + 1;
|
|
313
|
+
child = 2 * child + 1;
|
|
314
|
+
if (child + 1 < len && lt(a[childI]!, a[childI + 1]!)) {
|
|
315
|
+
++childI;
|
|
316
|
+
++child;
|
|
317
|
+
}
|
|
318
|
+
a[hole] = a[childI]!;
|
|
319
|
+
hole = childI;
|
|
320
|
+
if (child > Math.trunc((len - 2) / 2)) return hole;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** @see __algorithm/push_heap.h:__sift_up */
|
|
325
|
+
private siftUp(first: number, last: number, len: number): void {
|
|
326
|
+
const { a, lt } = this;
|
|
327
|
+
if (len > 1) {
|
|
328
|
+
len = Math.trunc((len - 2) / 2);
|
|
329
|
+
let ptr = first + len;
|
|
330
|
+
if (lt(a[ptr]!, a[--last]!)) {
|
|
331
|
+
const t = a[last]!;
|
|
332
|
+
do {
|
|
333
|
+
a[last] = a[ptr]!;
|
|
334
|
+
last = ptr;
|
|
335
|
+
if (len === 0) break;
|
|
336
|
+
len = Math.trunc((len - 1) / 2);
|
|
337
|
+
ptr = first + len;
|
|
338
|
+
} while (lt(a[ptr]!, t));
|
|
339
|
+
a[last] = t;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/** @see __algorithm/pop_heap.h:__pop_heap */
|
|
345
|
+
private popHeap(first: number, last: number, len: number): void {
|
|
346
|
+
const a = this.a;
|
|
347
|
+
if (len > 1) {
|
|
348
|
+
const top = a[first]!;
|
|
349
|
+
let hole = this.floydSiftDown(first, len);
|
|
350
|
+
--last;
|
|
351
|
+
if (hole === last) {
|
|
352
|
+
a[hole] = top;
|
|
353
|
+
} else {
|
|
354
|
+
a[hole] = a[last]!;
|
|
355
|
+
++hole;
|
|
356
|
+
a[last] = top;
|
|
357
|
+
this.siftUp(first, hole, hole - first);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/** @see __algorithm/make_heap.h:__make_heap */
|
|
363
|
+
private makeHeap(first: number, last: number): void {
|
|
364
|
+
const n = last - first;
|
|
365
|
+
if (n > 1) {
|
|
366
|
+
for (let start = Math.trunc((n - 2) / 2); start >= 0; --start) {
|
|
367
|
+
this.siftDown(first, n, start);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/** @see __algorithm/sort_heap.h:__sort_heap */
|
|
373
|
+
private sortHeap(first: number, last: number): void {
|
|
374
|
+
for (let n = last - first; n > 1; --last, --n) this.popHeap(first, last, n);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* `__partial_sort_impl(first, last, last, comp)`, as the depth fallback calls it.
|
|
379
|
+
* @see __algorithm/partial_sort.h:__partial_sort_impl
|
|
380
|
+
*/
|
|
381
|
+
private partialSort(first: number, last: number): void {
|
|
382
|
+
this.makeHeap(first, last);
|
|
383
|
+
this.sortHeap(first, last);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Tukey's ninther or the median of 3, leaving the pivot at `first`. Apart from `__introsort`
|
|
388
|
+
* because of the project's complexity limit.
|
|
389
|
+
* @see __algorithm/sort.h:__introsort
|
|
390
|
+
*/
|
|
391
|
+
private selectPivot(first: number, last: number, len: number): void {
|
|
392
|
+
const halfLen = Math.trunc(len / 2);
|
|
393
|
+
if (len > NINTHER_THRESHOLD) {
|
|
394
|
+
this.sort3(first, first + halfLen, last - 1);
|
|
395
|
+
this.sort3(first + 1, first + (halfLen - 1), last - 2);
|
|
396
|
+
this.sort3(first + 2, first + (halfLen + 1), last - 3);
|
|
397
|
+
this.sort3(first + (halfLen - 1), first + halfLen, first + (halfLen + 1));
|
|
398
|
+
this.swap(first, first + halfLen);
|
|
399
|
+
} else {
|
|
400
|
+
this.sort3(first + halfLen, first, last - 1);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* `__introsort`'s test for a pivot equal to the highest element on its left. Apart because of
|
|
406
|
+
* the project's complexity limit.
|
|
407
|
+
* @see __algorithm/sort.h:__introsort
|
|
408
|
+
*/
|
|
409
|
+
private pivotEqualsLeftNeighbour(first: number, leftmost: boolean): boolean {
|
|
410
|
+
return !leftmost && !this.lt(this.a[first - 1]!, this.a[first]!);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/** @see __algorithm/sort.h:__introsort */
|
|
414
|
+
introsort(first: number, last: number, depth: number, leftmost: boolean): void {
|
|
415
|
+
while (true) {
|
|
416
|
+
const len = last - first;
|
|
417
|
+
if (this.sortSmall(first, last)) return;
|
|
418
|
+
if (len < LIMIT) {
|
|
419
|
+
if (leftmost) this.insertionSort(first, last);
|
|
420
|
+
else this.insertionSortUnguarded(first, last);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
if (depth === 0) {
|
|
424
|
+
this.partialSort(first, last);
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
--depth;
|
|
428
|
+
this.selectPivot(first, last, len);
|
|
429
|
+
if (this.pivotEqualsLeftNeighbour(first, leftmost)) {
|
|
430
|
+
first = this.partitionWithEqualsOnLeft(first, last);
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
const [i, alreadyPartitioned] = this.partitionWithEqualsOnRight(first, last);
|
|
434
|
+
if (alreadyPartitioned) {
|
|
435
|
+
const fs = this.insertionSortIncomplete(first, i);
|
|
436
|
+
if (this.insertionSortIncomplete(i + 1, last)) {
|
|
437
|
+
if (fs) return;
|
|
438
|
+
last = i;
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
if (fs) {
|
|
442
|
+
first = i + 1;
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
this.introsort(first, i, depth, leftmost);
|
|
447
|
+
leftmost = false;
|
|
448
|
+
first = i + 1;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Sorts `a` in place as libc++ `std::sort(a.begin(), a.end(), lt)` does, for an element type that
|
|
455
|
+
* is not arithmetic and a comparator that is not `std::less`.
|
|
456
|
+
* @see __algorithm/sort.h:__sort_dispatch
|
|
457
|
+
*/
|
|
458
|
+
export function libcxxSort<T>(a: T[], lt: (x: T, y: T) => boolean): void {
|
|
459
|
+
if (a.length === 0) return;
|
|
460
|
+
new Introsort(a, lt).introsort(0, a.length, 2 * bitLog2(a.length), true);
|
|
461
|
+
}
|
package/src/vpsc/SweepLine.ts
CHANGED
|
@@ -10,35 +10,44 @@
|
|
|
10
10
|
import { Variable } from "./Variable.js";
|
|
11
11
|
import { Constraint } from "./Constraint.js";
|
|
12
12
|
import { Rectangle } from "./Solver.js";
|
|
13
|
-
import { EvType, SweepNode, SweepEvent } from "./sweepTypes.js";
|
|
13
|
+
import { EvType, NodeSet, SweepNode, SweepEvent } from "./sweepTypes.js";
|
|
14
|
+
import { libcxxSort } from "../util/libcxx-sort.js";
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* `seq` is the `make_shared<Node>` order: the rectangle index of the pass.
|
|
18
|
+
* @see lib/vpsc/generate-constraints.cpp: Node::Node
|
|
19
|
+
*/
|
|
20
|
+
export function makeNode(v: Variable, r: Rectangle, pos: number, seq: number): SweepNode {
|
|
16
21
|
return {
|
|
17
|
-
v, r, pos,
|
|
22
|
+
v, r, pos, seq,
|
|
18
23
|
firstAbove: null, firstBelow: null,
|
|
19
|
-
leftNeighbours:
|
|
24
|
+
leftNeighbours: [], rightNeighbours: [],
|
|
20
25
|
};
|
|
21
26
|
}
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (ea.
|
|
30
|
-
|
|
31
|
-
if (ea.pos > eb.pos) return 1;
|
|
32
|
-
return 0;
|
|
28
|
+
/** @see lib/vpsc/generate-constraints.cpp: compare_events */
|
|
29
|
+
export function compareEvents(ea: SweepEvent, eb: SweepEvent): boolean {
|
|
30
|
+
if (ea.node.r === eb.node.r) {
|
|
31
|
+
return ea.type === EvType.Open && eb.type !== EvType.Open;
|
|
32
|
+
}
|
|
33
|
+
if (ea.pos > eb.pos) return false;
|
|
34
|
+
if (ea.pos < eb.pos) return true;
|
|
35
|
+
return false;
|
|
33
36
|
}
|
|
34
37
|
|
|
38
|
+
/**
|
|
39
|
+
* C++ ends with `u < v` on `Node*`. Addresses cannot be reproduced and vary run
|
|
40
|
+
* to run, so a position tie goes by creation order (part-8 AD-8).
|
|
41
|
+
* @see lib/vpsc/generate-constraints.cpp: CmpNodePos::operator()
|
|
42
|
+
*/
|
|
35
43
|
export function nodePosLt(a: SweepNode, b: SweepNode): boolean {
|
|
36
44
|
if (a.pos < b.pos) return true;
|
|
37
45
|
if (b.pos < a.pos) return false;
|
|
38
|
-
return a < b;
|
|
46
|
+
return a.seq < b.seq;
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
|
|
49
|
+
/** @see lib/vpsc/generate-constraints.cpp: NodeSet::insert (std::set, so no duplicates) */
|
|
50
|
+
export function scanlineInsert(sl: NodeSet, node: SweepNode): void {
|
|
42
51
|
let lo = 0;
|
|
43
52
|
let hi = sl.length;
|
|
44
53
|
while (lo < hi) {
|
|
@@ -46,46 +55,49 @@ export function scanlineInsert(sl: SweepNode[], node: SweepNode): void {
|
|
|
46
55
|
if (nodePosLt(sl[mid]!, node)) lo = mid + 1;
|
|
47
56
|
else hi = mid;
|
|
48
57
|
}
|
|
49
|
-
sl.splice(lo, 0, node);
|
|
58
|
+
if (sl[lo] !== node) sl.splice(lo, 0, node);
|
|
50
59
|
}
|
|
51
60
|
|
|
52
|
-
export function scanlineRemove(sl:
|
|
61
|
+
export function scanlineRemove(sl: NodeSet, node: SweepNode): void {
|
|
53
62
|
const i = sl.indexOf(node);
|
|
54
63
|
if (i !== -1) sl.splice(i, 1);
|
|
55
64
|
}
|
|
56
65
|
|
|
57
|
-
|
|
58
|
-
|
|
66
|
+
/** @see lib/vpsc/generate-constraints.cpp: getLeftNeighbours */
|
|
67
|
+
export function getLeftNeighbours(sl: NodeSet, v: SweepNode): NodeSet {
|
|
68
|
+
const result: NodeSet = [];
|
|
59
69
|
const idx = sl.indexOf(v);
|
|
60
70
|
for (let i = idx - 1; i >= 0; i--) {
|
|
61
71
|
const u = sl[i]!;
|
|
62
|
-
if (u.r.overlapX(v.r) <= 0) { result
|
|
63
|
-
if (u.r.overlapX(v.r) <= u.r.overlapY(v.r)) result
|
|
72
|
+
if (u.r.overlapX(v.r) <= 0) { scanlineInsert(result, u); return result; }
|
|
73
|
+
if (u.r.overlapX(v.r) <= u.r.overlapY(v.r)) scanlineInsert(result, u);
|
|
64
74
|
}
|
|
65
75
|
return result;
|
|
66
76
|
}
|
|
67
77
|
|
|
68
|
-
|
|
69
|
-
|
|
78
|
+
/** @see lib/vpsc/generate-constraints.cpp: getRightNeighbours */
|
|
79
|
+
export function getRightNeighbours(sl: NodeSet, v: SweepNode): NodeSet {
|
|
80
|
+
const result: NodeSet = [];
|
|
70
81
|
const idx = sl.indexOf(v);
|
|
71
82
|
for (let i = idx + 1; i < sl.length; i++) {
|
|
72
83
|
const u = sl[i]!;
|
|
73
|
-
if (u.r.overlapX(v.r) <= 0) { result
|
|
74
|
-
if (u.r.overlapX(v.r) <= u.r.overlapY(v.r)) result
|
|
84
|
+
if (u.r.overlapX(v.r) <= 0) { scanlineInsert(result, u); return result; }
|
|
85
|
+
if (u.r.overlapX(v.r) <= u.r.overlapY(v.r)) scanlineInsert(result, u);
|
|
75
86
|
}
|
|
76
87
|
return result;
|
|
77
88
|
}
|
|
78
89
|
|
|
79
|
-
|
|
90
|
+
/** @see lib/vpsc/generate-constraints.cpp: Node::setNeighbours */
|
|
91
|
+
export function xOpenNeighbour(sl: NodeSet, v: SweepNode): void {
|
|
80
92
|
const left = getLeftNeighbours(sl, v);
|
|
81
93
|
const right = getRightNeighbours(sl, v);
|
|
82
94
|
v.leftNeighbours = left;
|
|
83
95
|
v.rightNeighbours = right;
|
|
84
|
-
for (const n of left) n.rightNeighbours
|
|
85
|
-
for (const n of right) n.leftNeighbours
|
|
96
|
+
for (const n of left) scanlineInsert(n.rightNeighbours, v);
|
|
97
|
+
for (const n of right) scanlineInsert(n.leftNeighbours, v);
|
|
86
98
|
}
|
|
87
99
|
|
|
88
|
-
export function openLinkChain(sl:
|
|
100
|
+
export function openLinkChain(sl: NodeSet, v: SweepNode): void {
|
|
89
101
|
const idx = sl.indexOf(v);
|
|
90
102
|
if (idx > 0) { const u = sl[idx - 1]!; v.firstAbove = u; u.firstBelow = v; }
|
|
91
103
|
if (idx < sl.length - 1) { const u = sl[idx + 1]!; v.firstBelow = u; u.firstAbove = v; }
|
|
@@ -94,14 +106,14 @@ export function openLinkChain(sl: SweepNode[], v: SweepNode): void {
|
|
|
94
106
|
export function xCloseLeft(v: SweepNode, cs: Constraint[]): void {
|
|
95
107
|
for (const u of v.leftNeighbours) {
|
|
96
108
|
cs.push(new Constraint(u.v, v.v, (v.r.width() + u.r.width()) / 2.0));
|
|
97
|
-
u.rightNeighbours
|
|
109
|
+
scanlineRemove(u.rightNeighbours, v);
|
|
98
110
|
}
|
|
99
111
|
}
|
|
100
112
|
|
|
101
113
|
export function xCloseRight(v: SweepNode, cs: Constraint[]): void {
|
|
102
114
|
for (const u of v.rightNeighbours) {
|
|
103
115
|
cs.push(new Constraint(v.v, u.v, (v.r.width() + u.r.width()) / 2.0));
|
|
104
|
-
u.leftNeighbours
|
|
116
|
+
scanlineRemove(u.leftNeighbours, v);
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
119
|
|
|
@@ -141,7 +153,7 @@ export function buildXEvents(rects: Rectangle[], vs: Variable[]): SweepEvent[] {
|
|
|
141
153
|
for (let i = 0; i < rects.length; i++) {
|
|
142
154
|
const r = rects[i]!;
|
|
143
155
|
vs[i]!.desiredPosition = r.getCentreX();
|
|
144
|
-
const node = makeNode(vs[i]!, r, r.getCentreX());
|
|
156
|
+
const node = makeNode(vs[i]!, r, r.getCentreX(), i);
|
|
145
157
|
events.push({ type: EvType.Open, node, pos: r.getMinY() });
|
|
146
158
|
events.push({ type: EvType.Close, node, pos: r.getMaxY() });
|
|
147
159
|
}
|
|
@@ -153,7 +165,7 @@ export function buildYEvents(rects: Rectangle[], vs: Variable[]): SweepEvent[] {
|
|
|
153
165
|
for (let i = 0; i < rects.length; i++) {
|
|
154
166
|
const r = rects[i]!;
|
|
155
167
|
vs[i]!.desiredPosition = r.getCentreY();
|
|
156
|
-
const node = makeNode(vs[i]!, r, r.getCentreY());
|
|
168
|
+
const node = makeNode(vs[i]!, r, r.getCentreY(), i);
|
|
157
169
|
events.push({ type: EvType.Open, node, pos: r.getMinX() });
|
|
158
170
|
events.push({ type: EvType.Close, node, pos: r.getMaxX() });
|
|
159
171
|
}
|
|
@@ -170,8 +182,8 @@ export function generateXConstraints(
|
|
|
170
182
|
useNeighbourLists: boolean
|
|
171
183
|
): Constraint[] {
|
|
172
184
|
const events = buildXEvents(rects, vs);
|
|
173
|
-
events
|
|
174
|
-
const sl:
|
|
185
|
+
libcxxSort(events, compareEvents);
|
|
186
|
+
const sl: NodeSet = [];
|
|
175
187
|
const cs: Constraint[] = [];
|
|
176
188
|
for (const e of events) {
|
|
177
189
|
const v = e.node;
|
|
@@ -197,8 +209,8 @@ export function generateYConstraints(
|
|
|
197
209
|
vs: Variable[]
|
|
198
210
|
): Constraint[] {
|
|
199
211
|
const events = buildYEvents(rects, vs);
|
|
200
|
-
events
|
|
201
|
-
const sl:
|
|
212
|
+
libcxxSort(events, compareEvents);
|
|
213
|
+
const sl: NodeSet = [];
|
|
202
214
|
const cs: Constraint[] = [];
|
|
203
215
|
for (const e of events) {
|
|
204
216
|
const v = e.node;
|
package/src/vpsc/sweepTypes.ts
CHANGED
|
@@ -14,14 +14,25 @@ import type { Rectangle } from "./Solver.js";
|
|
|
14
14
|
export const EvType = { Open: 0, Close: 1 } as const;
|
|
15
15
|
export type EvType = (typeof EvType)[keyof typeof EvType];
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* `std::set<Node*, CmpNodePos>`: an array kept in `nodePosLt` order.
|
|
19
|
+
* @see lib/vpsc/generate-constraints.cpp: NodeSet
|
|
20
|
+
*/
|
|
21
|
+
export type NodeSet = SweepNode[];
|
|
22
|
+
|
|
17
23
|
export interface SweepNode {
|
|
18
24
|
v: Variable;
|
|
19
25
|
r: Rectangle;
|
|
20
26
|
pos: number;
|
|
27
|
+
/**
|
|
28
|
+
* Creation order in this pass, standing in for the `Node*` address that
|
|
29
|
+
* `CmpNodePos` compares on a position tie (part-8 AD-8).
|
|
30
|
+
*/
|
|
31
|
+
seq: number;
|
|
21
32
|
firstAbove: SweepNode | null;
|
|
22
33
|
firstBelow: SweepNode | null;
|
|
23
|
-
leftNeighbours:
|
|
24
|
-
rightNeighbours:
|
|
34
|
+
leftNeighbours: NodeSet;
|
|
35
|
+
rightNeighbours: NodeSet;
|
|
25
36
|
}
|
|
26
37
|
|
|
27
38
|
export interface SweepEvent {
|