@knowvah/dot-engine 2.10.3 → 2.12.0
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/agerr.d.ts +12 -0
- package/dist/common/agerr.d.ts.map +1 -1
- package/dist/gvc/context.d.ts.map +1 -1
- package/dist/gvc/emit-xdot.d.ts.map +1 -1
- package/dist/gvc/layout-reset.d.ts +38 -1
- package/dist/gvc/layout-reset.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1260 -387
- package/dist/index.js.map +4 -4
- package/dist/layout/circo/circular.d.ts.map +1 -1
- package/dist/layout/dot/edge-route-chain.d.ts.map +1 -1
- package/dist/layout/dot/edge-route-helpers.d.ts +6 -1
- package/dist/layout/dot/edge-route-helpers.d.ts.map +1 -1
- package/dist/layout/dot/edge-route-rank.d.ts +4 -1
- 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/fdp/cluster-edges.d.ts +11 -0
- package/dist/layout/fdp/cluster-edges.d.ts.map +1 -1
- package/dist/layout/neato/closest.d.ts +20 -0
- package/dist/layout/neato/closest.d.ts.map +1 -0
- package/dist/layout/neato/constrained-majorization.d.ts +13 -0
- package/dist/layout/neato/constrained-majorization.d.ts.map +1 -1
- package/dist/layout/neato/embed-graph.d.ts +20 -0
- package/dist/layout/neato/embed-graph.d.ts.map +1 -0
- package/dist/layout/neato/fdp-adjust.d.ts.map +1 -1
- package/dist/layout/neato/index.d.ts.map +1 -1
- package/dist/layout/neato/init-dim.d.ts +54 -0
- package/dist/layout/neato/init-dim.d.ts.map +1 -0
- package/dist/layout/neato/init.d.ts +1 -11
- package/dist/layout/neato/init.d.ts.map +1 -1
- package/dist/layout/neato/kk.d.ts +4 -2
- package/dist/layout/neato/kk.d.ts.map +1 -1
- package/dist/layout/neato/matrix-ops-dense.d.ts +34 -0
- package/dist/layout/neato/matrix-ops-dense.d.ts.map +1 -0
- package/dist/layout/neato/pca.d.ts +14 -0
- package/dist/layout/neato/pca.d.ts.map +1 -0
- package/dist/layout/neato/sgd.d.ts +2 -3
- package/dist/layout/neato/sgd.d.ts.map +1 -1
- package/dist/layout/neato/start.d.ts +5 -5
- package/dist/layout/neato/start.d.ts.map +1 -1
- package/dist/layout/neato/stress-kernel.d.ts +10 -2
- package/dist/layout/neato/stress-kernel.d.ts.map +1 -1
- package/dist/layout/neato/stress-subspace.d.ts +39 -0
- package/dist/layout/neato/stress-subspace.d.ts.map +1 -0
- package/dist/layout/neato/vpsc-adjust.d.ts.map +1 -1
- package/dist/layout/pack/ccomps.d.ts +4 -2
- package/dist/layout/pack/ccomps.d.ts.map +1 -1
- package/dist/layout/sfdp/index.d.ts.map +1 -1
- package/dist/layout/sfdp/init.d.ts +6 -7
- package/dist/layout/sfdp/init.d.ts.map +1 -1
- package/dist/layout/twopi/circle.d.ts.map +1 -1
- package/dist/layout/twopi/index.d.ts.map +1 -1
- package/dist/render/dot/attrs.d.ts +7 -0
- package/dist/render/dot/attrs.d.ts.map +1 -1
- package/dist/render.js +1637 -770
- package/dist/render.js.map +4 -4
- package/package.json +4 -4
- package/src/common/agerr.ts +49 -1
- package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.1 +20 -0
- package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.2 +20 -0
- package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.3 +20 -0
- package/src/gvc/__fixtures__/rerender/abom-shift-pack.gv +1 -0
- package/src/gvc/__fixtures__/rerender/abom-shift-parity.dot.plain.nofree.1 +22 -0
- package/src/gvc/__fixtures__/rerender/abom-shift-parity.dot.plain.nofree.2 +22 -0
- package/src/gvc/__fixtures__/rerender/abom-shift-parity.dot.plain.nofree.3 +22 -0
- package/src/gvc/__fixtures__/rerender/abom-shift-parity.gv +1 -0
- package/src/gvc/__fixtures__/rerender/abom-shift.dot.plain.nofree.1 +13 -0
- package/src/gvc/__fixtures__/rerender/abom-shift.dot.plain.nofree.2 +13 -0
- package/src/gvc/__fixtures__/rerender/abom-shift.dot.plain.nofree.3 +13 -0
- package/src/gvc/__fixtures__/rerender/abom-shift.gv +1 -0
- package/src/gvc/__fixtures__/rerender/cluster-edge-splines.fdp.plain.1 +10 -0
- package/src/gvc/__fixtures__/rerender/cluster-edge-splines.fdp.plain.2 +11 -0
- package/src/gvc/__fixtures__/rerender/cluster-edge-splines.gv +9 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.dot.1 +40 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.dot.2 +40 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.plain.noaddr.1 +15 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.plain.noaddr.2 +17 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-dot-plain.1 +40 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-dot-plain.2 +15 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-dot-svg.1 +40 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-dot-svg.2 +99 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-json-json.1 +489 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-json-json.2 +503 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-nofree-dot-svg.1 +40 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-nofree-dot-svg.2 +109 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.xdot.1 +69 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.xdot.2 +70 -0
- package/src/gvc/__fixtures__/rerender/cluster-edges.gv +15 -0
- package/src/gvc/__fixtures__/rerender/fdp-1581.fdp.dot.1 +104 -0
- package/src/gvc/__fixtures__/rerender/fdp-1581.fdp.dot.2 +104 -0
- package/src/gvc/__fixtures__/rerender/fdp-1581.gv +26 -0
- package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.1 +34 -0
- package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.2 +34 -0
- package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.3 +34 -0
- package/src/gvc/__fixtures__/rerender/flat-rev-stale.gv +33 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.1 +181 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.2 +218 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.3 +255 -0
- package/src/gvc/__fixtures__/rerender/regen.sh +25 -0
- package/src/gvc/context.ts +7 -2
- package/src/gvc/emit-xdot.ts +37 -7
- package/src/gvc/layout-reset.ts +59 -1
- package/src/index.ts +4 -0
- package/src/layout/circo/circular.ts +3 -1
- package/src/layout/dot/edge-route-chain.ts +79 -7
- package/src/layout/dot/edge-route-helpers.ts +8 -2
- package/src/layout/dot/edge-route-rank.ts +20 -2
- package/src/layout/dot/index.ts +17 -2
- package/src/layout/dot/init.ts +9 -17
- package/src/layout/dot/splines-flat.ts +12 -12
- package/src/layout/dot/splines.ts +2 -2
- package/src/layout/fdp/cluster-edges.ts +0 -0
- package/src/layout/fdp/index.ts +2 -2
- package/src/layout/neato/__fixtures__/dim/circuit-dim3.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/circuit-dim3.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/circuit-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/circuit-dim3.xdot +54 -0
- package/src/layout/neato/__fixtures__/dim/dim11-dimen11.dot +32 -0
- package/src/layout/neato/__fixtures__/dim/dim11-dimen11.gv +11 -0
- package/src/layout/neato/__fixtures__/dim/dim11-dimen11.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/dim11-dimen11.xdot +53 -0
- package/src/layout/neato/__fixtures__/dim/dim3-dimen3.dot +32 -0
- package/src/layout/neato/__fixtures__/dim/dim3-dimen3.gv +11 -0
- package/src/layout/neato/__fixtures__/dim/dim3-dimen3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/dim3-dimen3.xdot +53 -0
- package/src/layout/neato/__fixtures__/dim/dim3.dot +31 -0
- package/src/layout/neato/__fixtures__/dim/dim3.gv +10 -0
- package/src/layout/neato/__fixtures__/dim/dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/dim3.xdot +52 -0
- package/src/layout/neato/__fixtures__/dim/dim4-dimen4.dot +32 -0
- package/src/layout/neato/__fixtures__/dim/dim4-dimen4.gv +11 -0
- package/src/layout/neato/__fixtures__/dim/dim4-dimen4.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/dim4-dimen4.xdot +53 -0
- package/src/layout/neato/__fixtures__/dim/dimen3.dot +31 -0
- package/src/layout/neato/__fixtures__/dim/dimen3.gv +10 -0
- package/src/layout/neato/__fixtures__/dim/dimen3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/dimen3.xdot +52 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-dim3.dot +267 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-dim3.gv +84 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-dim3.xdot +468 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-dim4.dot +267 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-dim4.gv +84 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-dim4.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-dim4.xdot +468 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.dot +268 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.gv +85 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.xdot +469 -0
- package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.dot +484 -0
- package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.gv +151 -0
- package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.xdot +852 -0
- package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.dot +34 -0
- package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.gv +13 -0
- package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.xdot +55 -0
- package/src/layout/neato/__fixtures__/dim/hier-dim3.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/hier-dim3.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/hier-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-dim3.xdot +54 -0
- package/src/layout/neato/__fixtures__/dim/hier-dim4.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/hier-dim4.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/hier-dim4.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-dim4.xdot +54 -0
- package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim2.dot +32 -0
- package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim2.gv +11 -0
- package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim2.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim2.xdot +53 -0
- package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim3.dot +34 -0
- package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim3.gv +13 -0
- package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim3.xdot +55 -0
- package/src/layout/neato/__fixtures__/dim/hier-len-dim3.dot +37 -0
- package/src/layout/neato/__fixtures__/dim/hier-len-dim3.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/hier-len-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-len-dim3.xdot +58 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-big.dot +141 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-big.gv +48 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-big.stderr +1 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-big.xdot +233 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim2.dot +21 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim2.gv +8 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim2.stderr +1 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim2.xdot +33 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim3.dot +23 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim3.gv +10 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim3.stderr +1 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim3.xdot +35 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim4.dot +23 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim4.gv +10 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim4.stderr +1 -0
- package/src/layout/neato/__fixtures__/dim/hier-noedge-dim4.xdot +35 -0
- package/src/layout/neato/__fixtures__/dim/hier-nohier-dim2.dot +26 -0
- package/src/layout/neato/__fixtures__/dim/hier-nohier-dim2.gv +7 -0
- package/src/layout/neato/__fixtures__/dim/hier-nohier-dim2.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-nohier-dim2.xdot +44 -0
- package/src/layout/neato/__fixtures__/dim/hier-nohier-dim3.dot +28 -0
- package/src/layout/neato/__fixtures__/dim/hier-nohier-dim3.gv +9 -0
- package/src/layout/neato/__fixtures__/dim/hier-nohier-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-nohier-dim3.xdot +46 -0
- package/src/layout/neato/__fixtures__/dim/hier-pack-dim3.dot +48 -0
- package/src/layout/neato/__fixtures__/dim/hier-pack-dim3.gv +15 -0
- package/src/layout/neato/__fixtures__/dim/hier-pack-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-pack-dim3.xdot +79 -0
- package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.dot +56 -0
- package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.gv +17 -0
- package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.xdot +94 -0
- package/src/layout/neato/__fixtures__/dim/hier-star-dim3.dot +47 -0
- package/src/layout/neato/__fixtures__/dim/hier-star-dim3.gv +14 -0
- package/src/layout/neato/__fixtures__/dim/hier-star-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-star-dim3.xdot +78 -0
- package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim3.dot +34 -0
- package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim3.gv +13 -0
- package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim3.xdot +55 -0
- package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.dot +34 -0
- package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.gv +13 -0
- package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.xdot +55 -0
- package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.dot +34 -0
- package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.gv +13 -0
- package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.xdot +55 -0
- package/src/layout/neato/__fixtures__/dim/hier-two-dim3.dot +15 -0
- package/src/layout/neato/__fixtures__/dim/hier-two-dim3.gv +6 -0
- package/src/layout/neato/__fixtures__/dim/hier-two-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/hier-two-dim3.xdot +22 -0
- package/src/layout/neato/__fixtures__/dim/ipsep-dim3.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/ipsep-dim3.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/ipsep-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/ipsep-dim3.xdot +54 -0
- package/src/layout/neato/__fixtures__/dim/kk-dim3.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/kk-dim3.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/kk-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/kk-dim3.xdot +54 -0
- package/src/layout/neato/__fixtures__/dim/kk-dim4-dimen4.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/kk-dim4-dimen4.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/kk-dim4-dimen4.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/kk-dim4-dimen4.xdot +54 -0
- package/src/layout/neato/__fixtures__/dim/kk-pins-dim3.dot +39 -0
- package/src/layout/neato/__fixtures__/dim/kk-pins-dim3.gv +15 -0
- package/src/layout/neato/__fixtures__/dim/kk-pins-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/kk-pins-dim3.xdot +60 -0
- package/src/layout/neato/__fixtures__/dim/overlap-false-dim3.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/overlap-false-dim3.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/overlap-false-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/overlap-false-dim3.xdot +54 -0
- package/src/layout/neato/__fixtures__/dim/overlap-scale-dim3.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/overlap-scale-dim3.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/overlap-scale-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/overlap-scale-dim3.xdot +54 -0
- package/src/layout/neato/__fixtures__/dim/overlap-vpsc-dim3.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/overlap-vpsc-dim3.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/overlap-vpsc-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/overlap-vpsc-dim3.xdot +54 -0
- package/src/layout/neato/__fixtures__/dim/pack-dim3.dot +47 -0
- package/src/layout/neato/__fixtures__/dim/pack-dim3.gv +14 -0
- package/src/layout/neato/__fixtures__/dim/pack-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/pack-dim3.xdot +78 -0
- package/src/layout/neato/__fixtures__/dim/pins-dim3.dot +38 -0
- package/src/layout/neato/__fixtures__/dim/pins-dim3.gv +14 -0
- package/src/layout/neato/__fixtures__/dim/pins-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/pins-dim3.xdot +59 -0
- package/src/layout/neato/__fixtures__/dim/regen.sh +24 -0
- package/src/layout/neato/__fixtures__/dim/regular-dim3.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/regular-dim3.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/regular-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/regular-dim3.xdot +54 -0
- package/src/layout/neato/__fixtures__/dim/sgd-dim3.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/sgd-dim3.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/sgd-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/sgd-dim3.xdot +54 -0
- package/src/layout/neato/__fixtures__/dim/smart-units.json +16 -0
- package/src/layout/neato/__fixtures__/dim/subset-dim3.dot +33 -0
- package/src/layout/neato/__fixtures__/dim/subset-dim3.gv +12 -0
- package/src/layout/neato/__fixtures__/dim/subset-dim3.stderr +0 -0
- package/src/layout/neato/__fixtures__/dim/subset-dim3.xdot +54 -0
- package/src/layout/neato/closest.ts +206 -0
- package/src/layout/neato/constrained-majorization.ts +4 -23
- package/src/layout/neato/embed-graph.ts +81 -0
- package/src/layout/neato/fdp-adjust.ts +22 -8
- package/src/layout/neato/index.ts +26 -17
- package/src/layout/neato/init-dim.ts +165 -0
- package/src/layout/neato/init.ts +9 -35
- package/src/layout/neato/kk.ts +47 -41
- package/src/layout/neato/matrix-ops-dense.ts +232 -0
- package/src/layout/neato/pca.ts +60 -0
- package/src/layout/neato/sgd.ts +14 -13
- package/src/layout/neato/start.ts +8 -5
- package/src/layout/neato/stress-kernel.ts +65 -5
- package/src/layout/neato/stress-subspace.ts +371 -0
- package/src/layout/neato/vpsc-adjust.ts +3 -1
- package/src/layout/pack/__fixtures__/cc-reuse/circo.dot +23 -0
- package/src/layout/pack/__fixtures__/cc-reuse/circo.gv +1 -0
- package/src/layout/pack/__fixtures__/cc-reuse/circo.stderr +0 -0
- package/src/layout/pack/__fixtures__/cc-reuse/circo.xdot +38 -0
- package/src/layout/pack/__fixtures__/cc-reuse/neato.dot +23 -0
- package/src/layout/pack/__fixtures__/cc-reuse/neato.gv +1 -0
- package/src/layout/pack/__fixtures__/cc-reuse/neato.stderr +0 -0
- package/src/layout/pack/__fixtures__/cc-reuse/neato.xdot +38 -0
- package/src/layout/pack/__fixtures__/cc-reuse/osage.dot +23 -0
- package/src/layout/pack/__fixtures__/cc-reuse/osage.gv +1 -0
- package/src/layout/pack/__fixtures__/cc-reuse/osage.stderr +0 -0
- package/src/layout/pack/__fixtures__/cc-reuse/osage.xdot +38 -0
- package/src/layout/pack/__fixtures__/cc-reuse/regen.sh +24 -0
- package/src/layout/pack/__fixtures__/cc-reuse/sfdp.dot +21 -0
- package/src/layout/pack/__fixtures__/cc-reuse/sfdp.gv +1 -0
- package/src/layout/pack/__fixtures__/cc-reuse/sfdp.stderr +0 -0
- package/src/layout/pack/__fixtures__/cc-reuse/sfdp.xdot +36 -0
- package/src/layout/pack/__fixtures__/cc-reuse/twopi.dot +21 -0
- package/src/layout/pack/__fixtures__/cc-reuse/twopi.gv +1 -0
- package/src/layout/pack/__fixtures__/cc-reuse/twopi.stderr +1 -0
- package/src/layout/pack/__fixtures__/cc-reuse/twopi.xdot +36 -0
- package/src/layout/pack/ccomps.ts +34 -6
- package/src/layout/sfdp/__fixtures__/dim/dim3-dimen3.dot +32 -0
- package/src/layout/sfdp/__fixtures__/dim/dim3-dimen3.gv +11 -0
- package/src/layout/sfdp/__fixtures__/dim/dim3-dimen3.stderr +0 -0
- package/src/layout/sfdp/__fixtures__/dim/dim3-dimen3.xdot +53 -0
- package/src/layout/sfdp/__fixtures__/dim/dim3.dot +31 -0
- package/src/layout/sfdp/__fixtures__/dim/dim3.gv +10 -0
- package/src/layout/sfdp/__fixtures__/dim/dim3.stderr +0 -0
- package/src/layout/sfdp/__fixtures__/dim/dim3.xdot +52 -0
- package/src/layout/sfdp/__fixtures__/dim/dim4-dimen4.dot +32 -0
- package/src/layout/sfdp/__fixtures__/dim/dim4-dimen4.gv +11 -0
- package/src/layout/sfdp/__fixtures__/dim/dim4-dimen4.stderr +0 -0
- package/src/layout/sfdp/__fixtures__/dim/dim4-dimen4.xdot +53 -0
- package/src/layout/sfdp/__fixtures__/dim/overlap-prism-dim3.dot +33 -0
- package/src/layout/sfdp/__fixtures__/dim/overlap-prism-dim3.gv +12 -0
- package/src/layout/sfdp/__fixtures__/dim/overlap-prism-dim3.stderr +0 -0
- package/src/layout/sfdp/__fixtures__/dim/overlap-prism-dim3.xdot +54 -0
- package/src/layout/sfdp/__fixtures__/dim/regen.sh +24 -0
- package/src/layout/sfdp/index.ts +15 -10
- package/src/layout/sfdp/init.ts +26 -11
- package/src/layout/twopi/circle.ts +5 -1
- package/src/layout/twopi/index.ts +3 -0
- package/src/render/dot/agwrite.ts +2 -2
- package/src/render/dot/attrs.ts +16 -0
- package/src/render/dot/write-back.ts +2 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SPDX-License-Identifier: EPL-2.0
|
|
3
|
+
# Regenerates these part-10 fixtures: graphviz 16.1.0 (oracle/16.1.0). One <case>.xdot,
|
|
4
|
+
# <case>.dot and <case>.stderr per <case>.gv. Engine neato. The .stderr is the -Txdot run's;
|
|
5
|
+
# regen reports a case whose -Tdot stderr differs. Inputs come from
|
|
6
|
+
# plans/post-16-1-followups-10/harness/T0/gen-fixtures.py.
|
|
7
|
+
#
|
|
8
|
+
# Usage: GVBINDIR=<full plugin dir> bash regen.sh
|
|
9
|
+
set -u
|
|
10
|
+
DOT=${DOT:-$HOME/git/graphviz/build/cmd/dot/dot}
|
|
11
|
+
cd "$(dirname "$0")"
|
|
12
|
+
for f in *.gv; do
|
|
13
|
+
c=${f%.gv}
|
|
14
|
+
e=neato
|
|
15
|
+
"$DOT" -K"$e" -Txdot "$f" > "$c.xdot" 2> "$c.stderr"
|
|
16
|
+
rc=$?
|
|
17
|
+
[ "$rc" -eq 0 ] || echo "$c: xdot exit $rc"
|
|
18
|
+
err=$(mktemp)
|
|
19
|
+
"$DOT" -K"$e" -Tdot "$f" > "$c.dot" 2> "$err"
|
|
20
|
+
rc=$?
|
|
21
|
+
[ "$rc" -eq 0 ] || echo "$c: dot exit $rc"
|
|
22
|
+
cmp -s "$c.stderr" "$err" || echo "$c: dot stderr differs"
|
|
23
|
+
rm -f "$err"
|
|
24
|
+
done
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
graph G {
|
|
2
|
+
graph [bb="0,0,158.85,246.82",
|
|
3
|
+
dim=3,
|
|
4
|
+
dimen=3,
|
|
5
|
+
start=regular
|
|
6
|
+
];
|
|
7
|
+
node [label="\N"];
|
|
8
|
+
a [height=0.5,
|
|
9
|
+
pos="131.85,157.43,-6.798",
|
|
10
|
+
width=0.75];
|
|
11
|
+
b [height=0.5,
|
|
12
|
+
pos="130.64,228.82,5.5881",
|
|
13
|
+
width=0.75];
|
|
14
|
+
a -- b [pos="131.54,175.82 131.36,186.56 131.13,200.06 130.95,210.75"];
|
|
15
|
+
c [height=0.5,
|
|
16
|
+
pos="67.177,200.95,-15.639",
|
|
17
|
+
width=0.75];
|
|
18
|
+
a -- c [pos="112.45,170.49 104.26,176 94.752,182.4 86.568,187.91"];
|
|
19
|
+
b -- c [pos="107.73,218.76 101.9,216.2 95.651,213.46 89.841,210.91"];
|
|
20
|
+
d [height=0.5,
|
|
21
|
+
pos="27,133.3,-6.4389",
|
|
22
|
+
width=0.75];
|
|
23
|
+
c -- d [pos="57.038,183.88 50.901,173.55 43.107,160.42 36.996,150.13"];
|
|
24
|
+
e [height=0.5,
|
|
25
|
+
pos="92.225,89.745,3.2848",
|
|
26
|
+
width=0.75];
|
|
27
|
+
d -- e [pos="46.217,120.47 54.634,114.84 64.493,108.26 72.92,102.64"];
|
|
28
|
+
e -- a [pos="102.22,106.83 108.28,117.17 115.97,130.3 121.99,140.59"];
|
|
29
|
+
f [height=0.5,
|
|
30
|
+
pos="107.82,18,20.003",
|
|
31
|
+
width=0.75];
|
|
32
|
+
e -- f [pos="96.161,71.641 98.544,60.682 101.57,46.763 103.94,35.85"];
|
|
33
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
graph G {
|
|
2
|
+
graph [_draw_="c 9 -#fffffe00 C 7 -#ffffff P 4 0 0 0 246.82 158.85 246.82 158.85 0 ",
|
|
3
|
+
bb="0,0,158.85,246.82",
|
|
4
|
+
dim=3,
|
|
5
|
+
dimen=3,
|
|
6
|
+
start=regular,
|
|
7
|
+
xdotversion=1.7
|
|
8
|
+
];
|
|
9
|
+
node [label="\N"];
|
|
10
|
+
a [_draw_="c 7 -#000000 e 131.85 157.43 27 18 ",
|
|
11
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 131.85 153.23 0 6.21 1 -a ",
|
|
12
|
+
height=0.5,
|
|
13
|
+
pos="131.85,157.43,-6.798",
|
|
14
|
+
width=0.75];
|
|
15
|
+
b [_draw_="c 7 -#000000 e 130.64 228.82 27 18 ",
|
|
16
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 130.64 224.62 0 7 1 -b ",
|
|
17
|
+
height=0.5,
|
|
18
|
+
pos="130.64,228.82,5.5881",
|
|
19
|
+
width=0.75];
|
|
20
|
+
a -- b [_draw_="c 7 -#000000 B 4 131.54 175.82 131.36 186.56 131.13 200.06 130.95 210.75 ",
|
|
21
|
+
pos="131.54,175.82 131.36,186.56 131.13,200.06 130.95,210.75"];
|
|
22
|
+
c [_draw_="c 7 -#000000 e 67.18 200.95 27 18 ",
|
|
23
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 67.18 196.75 0 6.21 1 -c ",
|
|
24
|
+
height=0.5,
|
|
25
|
+
pos="67.177,200.95,-15.639",
|
|
26
|
+
width=0.75];
|
|
27
|
+
a -- c [_draw_="c 7 -#000000 B 4 112.45 170.49 104.26 176 94.75 182.4 86.57 187.91 ",
|
|
28
|
+
pos="112.45,170.49 104.26,176 94.752,182.4 86.568,187.91"];
|
|
29
|
+
b -- c [_draw_="c 7 -#000000 B 4 107.73 218.76 101.9 216.2 95.65 213.46 89.84 210.91 ",
|
|
30
|
+
pos="107.73,218.76 101.9,216.2 95.651,213.46 89.841,210.91"];
|
|
31
|
+
d [_draw_="c 7 -#000000 e 27 133.3 27 18 ",
|
|
32
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 27 129.1 0 7 1 -d ",
|
|
33
|
+
height=0.5,
|
|
34
|
+
pos="27,133.3,-6.4389",
|
|
35
|
+
width=0.75];
|
|
36
|
+
c -- d [_draw_="c 7 -#000000 B 4 57.04 183.88 50.9 173.55 43.11 160.42 37 150.13 ",
|
|
37
|
+
pos="57.038,183.88 50.901,173.55 43.107,160.42 36.996,150.13"];
|
|
38
|
+
e [_draw_="c 7 -#000000 e 92.23 89.75 27 18 ",
|
|
39
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 92.23 85.55 0 6.21 1 -e ",
|
|
40
|
+
height=0.5,
|
|
41
|
+
pos="92.225,89.745,3.2848",
|
|
42
|
+
width=0.75];
|
|
43
|
+
d -- e [_draw_="c 7 -#000000 B 4 46.22 120.47 54.63 114.84 64.49 108.26 72.92 102.64 ",
|
|
44
|
+
pos="46.217,120.47 54.634,114.84 64.493,108.26 72.92,102.64"];
|
|
45
|
+
e -- a [_draw_="c 7 -#000000 B 4 102.22 106.83 108.28 117.17 115.97 130.3 121.99 140.59 ",
|
|
46
|
+
pos="102.22,106.83 108.28,117.17 115.97,130.3 121.99,140.59"];
|
|
47
|
+
f [_draw_="c 7 -#000000 e 107.82 18 27 18 ",
|
|
48
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 107.82 13.8 0 4.66 1 -f ",
|
|
49
|
+
height=0.5,
|
|
50
|
+
pos="107.82,18,20.003",
|
|
51
|
+
width=0.75];
|
|
52
|
+
e -- f [_draw_="c 7 -#000000 B 4 96.16 71.64 98.54 60.68 101.57 46.76 103.94 35.85 ",
|
|
53
|
+
pos="96.161,71.641 98.544,60.682 101.57,46.763 103.94,35.85"];
|
|
54
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
graph G {
|
|
2
|
+
graph [bb="0,0,154.1,250.49",
|
|
3
|
+
dim=3,
|
|
4
|
+
dimen=3,
|
|
5
|
+
mode=sgd
|
|
6
|
+
];
|
|
7
|
+
node [label="\N"];
|
|
8
|
+
a [height=0.5,
|
|
9
|
+
pos="28.123,161.27,60.107",
|
|
10
|
+
width=0.75];
|
|
11
|
+
b [height=0.5,
|
|
12
|
+
pos="38.802,232.49,0.12722",
|
|
13
|
+
width=0.75];
|
|
14
|
+
a -- b [pos="30.873,179.61 32.48,190.33 34.5,203.8 36.098,214.46"];
|
|
15
|
+
c [height=0.5,
|
|
16
|
+
pos="99.439,193.47,54.036",
|
|
17
|
+
width=0.75];
|
|
18
|
+
a -- c [pos="50.688,171.45 59.012,175.21 68.443,179.47 76.776,183.23"];
|
|
19
|
+
b -- c [pos="58.657,219.72 65.427,215.36 72.99,210.49 79.747,206.14"];
|
|
20
|
+
d [height=0.5,
|
|
21
|
+
pos="127.1,119.9,41.281",
|
|
22
|
+
width=0.75];
|
|
23
|
+
c -- d [pos="106.14,175.66 110.45,164.18 116.05,149.3 120.37,137.8"];
|
|
24
|
+
e [height=0.5,
|
|
25
|
+
pos="55.581,87.694,68.461",
|
|
26
|
+
width=0.75];
|
|
27
|
+
d -- e [pos="104.47,109.71 96.125,105.95 86.667,101.69 78.31,97.929"];
|
|
28
|
+
e -- a [pos="48.934,105.5 44.649,116.99 39.096,131.87 34.804,143.37"];
|
|
29
|
+
f [height=0.5,
|
|
30
|
+
pos="27,18,15.594",
|
|
31
|
+
width=0.75];
|
|
32
|
+
e -- f [pos="48.369,70.107 44.069,59.623 38.626,46.349 34.309,35.823"];
|
|
33
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
graph G {
|
|
2
|
+
graph [_draw_="c 9 -#fffffe00 C 7 -#ffffff P 4 0 0 0 250.49 154.1 250.49 154.1 0 ",
|
|
3
|
+
bb="0,0,154.1,250.49",
|
|
4
|
+
dim=3,
|
|
5
|
+
dimen=3,
|
|
6
|
+
mode=sgd,
|
|
7
|
+
xdotversion=1.7
|
|
8
|
+
];
|
|
9
|
+
node [label="\N"];
|
|
10
|
+
a [_draw_="c 7 -#000000 e 28.12 161.27 27 18 ",
|
|
11
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 28.12 157.07 0 6.21 1 -a ",
|
|
12
|
+
height=0.5,
|
|
13
|
+
pos="28.123,161.27,60.107",
|
|
14
|
+
width=0.75];
|
|
15
|
+
b [_draw_="c 7 -#000000 e 38.8 232.49 27 18 ",
|
|
16
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 38.8 228.29 0 7 1 -b ",
|
|
17
|
+
height=0.5,
|
|
18
|
+
pos="38.802,232.49,0.12722",
|
|
19
|
+
width=0.75];
|
|
20
|
+
a -- b [_draw_="c 7 -#000000 B 4 30.87 179.61 32.48 190.33 34.5 203.8 36.1 214.46 ",
|
|
21
|
+
pos="30.873,179.61 32.48,190.33 34.5,203.8 36.098,214.46"];
|
|
22
|
+
c [_draw_="c 7 -#000000 e 99.44 193.47 27 18 ",
|
|
23
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 99.44 189.27 0 6.21 1 -c ",
|
|
24
|
+
height=0.5,
|
|
25
|
+
pos="99.439,193.47,54.036",
|
|
26
|
+
width=0.75];
|
|
27
|
+
a -- c [_draw_="c 7 -#000000 B 4 50.69 171.45 59.01 175.21 68.44 179.47 76.78 183.23 ",
|
|
28
|
+
pos="50.688,171.45 59.012,175.21 68.443,179.47 76.776,183.23"];
|
|
29
|
+
b -- c [_draw_="c 7 -#000000 B 4 58.66 219.72 65.43 215.36 72.99 210.49 79.75 206.14 ",
|
|
30
|
+
pos="58.657,219.72 65.427,215.36 72.99,210.49 79.747,206.14"];
|
|
31
|
+
d [_draw_="c 7 -#000000 e 127.1 119.9 27 18 ",
|
|
32
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 127.1 115.7 0 7 1 -d ",
|
|
33
|
+
height=0.5,
|
|
34
|
+
pos="127.1,119.9,41.281",
|
|
35
|
+
width=0.75];
|
|
36
|
+
c -- d [_draw_="c 7 -#000000 B 4 106.14 175.66 110.45 164.18 116.05 149.3 120.37 137.8 ",
|
|
37
|
+
pos="106.14,175.66 110.45,164.18 116.05,149.3 120.37,137.8"];
|
|
38
|
+
e [_draw_="c 7 -#000000 e 55.58 87.69 27 18 ",
|
|
39
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 55.58 83.49 0 6.21 1 -e ",
|
|
40
|
+
height=0.5,
|
|
41
|
+
pos="55.581,87.694,68.461",
|
|
42
|
+
width=0.75];
|
|
43
|
+
d -- e [_draw_="c 7 -#000000 B 4 104.47 109.71 96.13 105.95 86.67 101.69 78.31 97.93 ",
|
|
44
|
+
pos="104.47,109.71 96.125,105.95 86.667,101.69 78.31,97.929"];
|
|
45
|
+
e -- a [_draw_="c 7 -#000000 B 4 48.93 105.5 44.65 116.99 39.1 131.87 34.8 143.37 ",
|
|
46
|
+
pos="48.934,105.5 44.649,116.99 39.096,131.87 34.804,143.37"];
|
|
47
|
+
f [_draw_="c 7 -#000000 e 27 18 27 18 ",
|
|
48
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 27 13.8 0 4.66 1 -f ",
|
|
49
|
+
height=0.5,
|
|
50
|
+
pos="27,18,15.594",
|
|
51
|
+
width=0.75];
|
|
52
|
+
e -- f [_draw_="c 7 -#000000 B 4 48.37 70.11 44.07 59.62 38.63 46.35 34.31 35.82 ",
|
|
53
|
+
pos="48.369,70.107 44.069,59.623 38.626,46.349 34.309,35.823"];
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"closestDistinct":{"graph":[{"edges":[0,6,2,7,1,4,3,5],"ewgts":[-7,1,1,1,1,1,1,1]},{"edges":[1,6,2,7,4,0,5,3],"ewgts":[-7,1,1,1,1,1,1,1]},{"edges":[2,1,3,5,0,4,7,6],"ewgts":[-7,1,1,1,1,1,1,1]},{"edges":[3,6,2,7,4,0,1,5],"ewgts":[-7,1,1,1,1,1,1,1]},{"edges":[4,6,1,3,5,2,0,7],"ewgts":[-7,1,1,1,1,1,1,1]},{"edges":[5,6,2,7,4,1,0,3],"ewgts":[-7,1,1,1,1,1,1,1]},{"edges":[6,1,3,5,0,4,7,2],"ewgts":[-7,1,1,1,1,1,1,1]},{"edges":[7,1,6,3,5,0,2,4],"ewgts":[-7,1,1,1,1,1,1,1]}],"next":1954899097},
|
|
3
|
+
"closestTies":{"graph":[{"edges":[0,7,5,4,6,3,1,2],"ewgts":[-7,1,1,1,1,1,1,1]},{"edges":[1,8,7,5,4,6,0,3,2],"ewgts":[-8,1,1,1,1,1,1,1,1]},{"edges":[2,8,7,5,6,4,3,0,1],"ewgts":[-8,1,1,1,1,1,1,1,1]},{"edges":[3,8,7,0,6,2,1,5,4],"ewgts":[-8,1,1,1,1,1,1,1,1]},{"edges":[4,8,0,1,7,2,3,6,5],"ewgts":[-8,1,1,1,1,1,1,1,1]},{"edges":[5,8,0,2,1,7,3,4,6],"ewgts":[-8,1,1,1,1,1,1,1,1]},{"edges":[6,8,0,1,7,2,3,4,5],"ewgts":[-8,1,1,1,1,1,1,1,1]},{"edges":[7,0,2,1,3,6,5,4,8],"ewgts":[-8,1,1,1,1,1,1,1,1]},{"edges":[8,2,1,3,4,5,6,7],"ewgts":[-7,1,1,1,1,1,1,1]}],"next":1534827968},
|
|
4
|
+
"closestFew":{"graph":[{"edges":[0],"ewgts":[0]},{"edges":[1,2],"ewgts":[-1,1]},{"edges":[2,1],"ewgts":[-1,1]},{"edges":[3],"ewgts":[0]},{"edges":[4,5],"ewgts":[-1,1]},{"edges":[5,4,6],"ewgts":[-2,1,1]},{"edges":[6,5],"ewgts":[-1,1]},{"edges":[7],"ewgts":[0]},{"edges":[8],"ewgts":[0]}],"next":143542612},
|
|
5
|
+
"embedPlain":{"coords":[[0,1,2,3,4,5,2],[5,4,3,2,1,0,4],[2,1,0,1,2,3,1],[1,0,1,2,3,4,1],[3,2,1,0,1,2,2],[4,3,2,1,0,1,3],[2,1,1,2,3,4,0]],"centered":[[-2,-1,0,1,2,3,0],[3,2,1,0,-1,-2,2],[1,0,-1,0,1,2,0],[0,-1,0,1,2,3,0],[2,1,0,-1,0,1,1],[2,1,0,-1,-2,-1,1],[1,0,0,1,2,3,-1]],"next":282475249},
|
|
6
|
+
"embedReweight":{"coords":[[0,4,8,13,17,20,7],[20,16,12,7,3,0,15],[8,4,0,5,9,12,3],[13,9,5,0,4,7,8],[4,0,4,9,13,16,3]],"restored":[0,1,1,1],"next":282475249},
|
|
7
|
+
"pca":{"coords":[[-2.7548760623481638,-2.3375968595209469,-0.67246271258982793,1.774194607276617,4.0605321903708766,5.610687843553416,-1.780644243521428],[3.8708962394599791,1.464041668463778,0.091973686556957035,-0.068067418041941941,0.81752965060037019,2.2335636753828028,1.2740561040276397],[-0.12009681255827936,0.25763444913644834,1.1005492947702908,1.2187547207655711,0.73057029969325338,-0.53776426820139966,0.62001604072150029],[-0.59660125448471435,-0.095762687147302988,0.093964020014114608,-0.41870192615119661,-0.23226007363506085,0.40069687447132607,1.3287429042846519],[-0.085638739501445182,0.15335000280711253,0.53231921267076632,-0.12089802099644931,-0.28409114540972058,0.25633420750695957,-0.23050615043605927],[-0.19286401659438571,0.46747740300431329,-0.024430734350930142,-0.33368952238683625,0.3785749444581476,-0.088621385215575443,-0.054507086357724256],[-0.10923992217117132,0.27317680730159138,-0.18797911831239408,0.24690265476291237,-0.17893889817637659,0.089810138577796989,0.0023275551716234466]],"next":1646035001},
|
|
8
|
+
"ipca":{"direction":[-0.99368573881700695,0.11040850422414196,0.019695986878962447,0.002784610417702373,0.0012540034789935853,0.00086917805616704841,0.00077505945169040115],"ok":true,"next":1654001669},
|
|
9
|
+
"powerSym":{"eigs":[[0.30842409654433556,0.43951658943880922,0.58671853417399555,-0.46006327255382157,0.11357567134741803,0.33604462204521657,0.034429765657137734,0.072185654700968743,0.15356201531411282],[0.20534466745806709,-0.00043364027114115445,-0.085360892493579393,0.53159279311757024,0.038303714513752668,0.31111335967204184,0.38457455457585621,0.20199574780027665,0.6172498947527032],[0.49111992675075261,0.066220214818517933,0.33465677552750372,0.46652937262780847,0.19817513019200164,-0.33355287602046396,0.21977934498667837,-0.15988145212767924,-0.44763304750810523]],"ok":false,"next":1358580979},
|
|
10
|
+
"powerRank1":{"eigs":[[0.05923488777590924,0.11846977555181848,0.17770466332772769,0.23693955110363696,0.29617443887954614,0.35540932665545538,0.41464421443136468,0.47387910220727392,0.53311398998318316],[0.42636901225402379,-0.056386351934133244,-0.28512166976344561,0.48885372171847086,-0.42172487844247708,0.11159994280474445,0.04329833846522857,-0.42608754959877876,0.34788784188313771],[0.44603980864282378,0.088466328432394228,0.39771596708190948,0.41677836005286578,0.28172034734122142,-0.32316325855898786,0.24716811550983037,-0.067528244711819951,-0.46031187146569263],[0.41089116214515697,0.27384393112535416,0.34028053280293413,-0.59694370923348183,0.067752510789046816,0.29541551798680898,0.060489813397798881,-0.41378702381652888,0.1315517832234229],[-0.42157523939455488,0.068481287147418954,0.5594373199261754,0.27483682918752805,0.089244489468838811,-0.17558011533518739,-0.35217873707438313,-0.35201237507815863,0.37728464370932868],[0.19405708883548459,0.77669522632703436,-0.144026027895826,0.074264408867213555,-0.082684396243854444,-0.15224290031176843,-0.45370818342112468,0.30772366944902113,0.047624468686072841],[0.30256159394792864,-0.37320050321357967,0.47402240066549589,-0.089618507367673086,-0.51498340876458126,-0.026349624937612462,-0.26525442793194631,0.44510664099857006,0.045465433437453191],[0.19884695190727819,-0.26332727230971376,-0.082520878705586415,0.18639110451310237,0.45721160166058772,0.52046715620261341,-0.58643643306064752,-0.003841462141384944,-0.16036315624294639],[0.31693874932480753,-0.28879693988380883,-0.21894590928739238,-0.22585855900617838,0.40177160620705066,-0.58646244749853338,-0.13151332391116308,0.036972746930491823,0.43951722669109544]],"ok":true,"next":500782188},
|
|
11
|
+
"powerZero":{"eigs":[[0.056602654125738665,0.25156735166994965,0.40879694646366815,0.57860490884088411,0.2641457192534471,0.5471589898821404,0.018867551375246223,0.16980796237721599,0.18238632996071347],[0.29482552182811583,-0.12428565353456845,-0.34475323790281576,0.072413706424339808,-0.16165391095510964,-0.0029163465532931311,0.5021229946958341,0.13158884250887151,0.69133843434474229]],"ok":true,"next":1404280278},
|
|
12
|
+
"powerRotation":{"eigs":[[0.78295719659593699,0.62207558085704584]],"ok":false,"next":1144108930},
|
|
13
|
+
"multDense":{"c":[[-15.477347373962402,-18.765100479125977,-83.88958740234375,15.883878707885742,53.820610046386719,-38.305919647216797,40.855308532714844,58.179794311523438,13.667551040649414,-74.130409240722656],[-57.709999084472656,-5.956939697265625,-16.040611267089844,-69.409996032714844,23.567554473876953,62.747142791748047,-11.234490394592285,61.130817413330078,71.659385681152344,38.902248382568359],[52.794082641601562,-27.983469009399414,37.585918426513672,59.869594573974609,20.316530227661133,3.2308166027069092,4.902245044708252,-55.263057708740234,30.918573379516602,73.814491271972656],[43.953262329101562,59.441020965576172,13.092040061950684,-76.542655944824219,-19.830408096313477,-72.569183349609375,25.367551803588867,61.467548370361328,35.730815887451172,-33.291629791259766],[-18.891632080078125,51.636936187744141,60.328777313232422,25.734897613525391,-70.695716857910156,7.8716340065002441,-47.334487915039062,43.806327819824219,73.110404968261719,59.128776550292969],[-5.2651028633117676,-67.267143249511719,17.077754974365234,58.136940002441406,37.359386444091797,59.661430358886719,80.108367919921875,38.718570709228516,-64.507957458496094,-2.8365302085876465],[27.118570327758789,61.381839752197266,33.808364868164062,-37.050819396972656,38.436939239501953,25.085916519165039,-66.385513305664062,-11.50999927520752,-18.471223831176758,-68.718162536621094],[-56.338569641113281,32.965507507324219,60.432861328125,44.614490509033203,-33.040611267089844,84.91448974609375,48.483875274658203,-49.783470153808594,-1.7038754224777222,3.0900006294250488],[60.555309295654297,37.941020965576172,-46.510002136230469,33.936939239501953,52.547142028808594,-73.334487915039062,-13.499794006347656,-15.501836776733398,-79.340614318847656,21.718570709228516]],"d":[[-15.477347687312522,-18.765100539582104,-83.889590398754393,15.883878490754542,53.820611297871402,-38.30591933280229,40.855308543145647,58.179793329962649,13.667551138571319,-74.130407463652745],[-57.710000743184764,-5.9569394596985319,-16.040611027819764,-69.409998438187998,23.567553585980615,62.747142748534678,-11.234490590648987,61.130819137394425,71.659386545419693,38.902246523754933],[52.794083401135026,-27.983469751051501,37.585918061222351,59.869593701192322,20.316530350915038,3.2308165403349181,4.90224520627942,-55.263058370990407,30.918573485953463,73.814488834142665],[43.953264229638222,59.441022012063435,13.092039773293902,-76.542654407875887,-19.830407547312106,-72.569182596674978,25.367552388778755,61.467550126356748,35.730817645788193,-33.291631607498438],[-18.891632495607649,51.636937702553602,60.328777194874625,25.734897234610145,-70.695714088635782,7.8716340952686084,-47.334488694369774,43.806328824375363,73.110408523253042,59.128777850525729],[-5.2651030574526079,-67.267142134904859,17.077755017791468,58.136941547904684,37.359387951024928,59.661428861745769,80.108368077235568,38.718572290667467,-64.50795924237795,-2.8365302452019185],[27.118570269857138,61.381838686977126,33.808366648639961,-37.050817502396448,38.436939971574695,25.085917063483162,-66.38551136233977,-11.509998953981045,-18.471224303756433,-68.718163348095757],[-56.338570124762391,32.965508988073893,60.432859540837164,44.614489610706059,-33.040611959142332,84.914491806072832,48.483876125940242,-49.783469085395339,-1.7038753756454976,3.0900007205350213],[60.555308267048439,37.941020913634993,-46.510000304664878,33.936939064945506,52.547141470866556,-73.334490608530388,-13.499793734082161,-15.501836985562532,-79.340613633394241,21.718570962122513]]},
|
|
14
|
+
"multSparse":{"c":[[5.4142856597900391,-3.7285714149475098,1.5571428537368774],[10.591428756713867,-2.1371424198150635,-14.865715026855469],[6.2428569793701172,7.6714286804199219,-5.3285713195800781],[5.114285945892334,1.2571429014205933,-2.5999999046325684],[2.2571427822113037,12.828571319580078,-5.4571428298950195],[1.1285713911056519,6.4142856597900391,-2.7285714149475098],[9.3999996185302734,-8.8857145309448242,1.6857142448425293]]},
|
|
15
|
+
"rightT":{"r":[-49.269591836734683,-67.373673469387754,-71.049183673469386,-54.112448979591832,-16.563469387755088,56.026326530612252,149.22836734693877,54.858979591836736,49.328367346938791,-10.000204081632651,-48.716530612244902]}
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
graph G {
|
|
2
|
+
graph [bb="0,0,516.49,931.23",
|
|
3
|
+
dim=3,
|
|
4
|
+
dimen=3,
|
|
5
|
+
model=subset
|
|
6
|
+
];
|
|
7
|
+
node [label="\N"];
|
|
8
|
+
a [height=0.5,
|
|
9
|
+
pos="83.7,741.64,0.77966",
|
|
10
|
+
width=0.75];
|
|
11
|
+
b [height=0.5,
|
|
12
|
+
pos="212.42,913.23,-34.816",
|
|
13
|
+
width=0.75];
|
|
14
|
+
a -- b [pos="96.043,758.1 120.65,790.89 175.55,864.07 200.12,896.83"];
|
|
15
|
+
c [height=0.5,
|
|
16
|
+
pos="371.58,814.55,75.096",
|
|
17
|
+
width=0.75];
|
|
18
|
+
a -- c [pos="109.25,748.11 163.88,761.95 291.51,794.27 346.09,808.1"];
|
|
19
|
+
b -- c [pos="232.58,900.73 263.2,881.75 321.07,845.87 351.58,826.95"];
|
|
20
|
+
d [height=0.5,
|
|
21
|
+
pos="489.49,432.48,81.66",
|
|
22
|
+
width=0.75];
|
|
23
|
+
c -- d [pos="377.11,796.64 396.91,732.46 464.18,514.47 483.97,450.36"];
|
|
24
|
+
e [height=0.5,
|
|
25
|
+
pos="153.23,270.14,-15.197",
|
|
26
|
+
width=0.75];
|
|
27
|
+
d -- e [pos="467.16,421.7 406,392.17 236.22,310.21 175.32,280.81"];
|
|
28
|
+
e -- a [pos="150.54,288.34 139.49,363.31 97.523,647.9 86.413,723.25"];
|
|
29
|
+
f [height=0.5,
|
|
30
|
+
pos="27,18,-107.52",
|
|
31
|
+
width=0.75];
|
|
32
|
+
e -- f [pos="144.55,252.81 121.49,206.75 58.866,81.653 35.737,35.452"];
|
|
33
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
graph G {
|
|
2
|
+
graph [_draw_="c 9 -#fffffe00 C 7 -#ffffff P 4 0 0 0 931.23 516.49 931.23 516.49 0 ",
|
|
3
|
+
bb="0,0,516.49,931.23",
|
|
4
|
+
dim=3,
|
|
5
|
+
dimen=3,
|
|
6
|
+
model=subset,
|
|
7
|
+
xdotversion=1.7
|
|
8
|
+
];
|
|
9
|
+
node [label="\N"];
|
|
10
|
+
a [_draw_="c 7 -#000000 e 83.7 741.64 27 18 ",
|
|
11
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 83.7 737.44 0 6.21 1 -a ",
|
|
12
|
+
height=0.5,
|
|
13
|
+
pos="83.7,741.64,0.77966",
|
|
14
|
+
width=0.75];
|
|
15
|
+
b [_draw_="c 7 -#000000 e 212.42 913.23 27 18 ",
|
|
16
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 212.42 909.03 0 7 1 -b ",
|
|
17
|
+
height=0.5,
|
|
18
|
+
pos="212.42,913.23,-34.816",
|
|
19
|
+
width=0.75];
|
|
20
|
+
a -- b [_draw_="c 7 -#000000 B 4 96.04 758.1 120.65 790.89 175.55 864.07 200.12 896.83 ",
|
|
21
|
+
pos="96.043,758.1 120.65,790.89 175.55,864.07 200.12,896.83"];
|
|
22
|
+
c [_draw_="c 7 -#000000 e 371.58 814.55 27 18 ",
|
|
23
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 371.58 810.35 0 6.21 1 -c ",
|
|
24
|
+
height=0.5,
|
|
25
|
+
pos="371.58,814.55,75.096",
|
|
26
|
+
width=0.75];
|
|
27
|
+
a -- c [_draw_="c 7 -#000000 B 4 109.25 748.11 163.88 761.95 291.51 794.27 346.09 808.1 ",
|
|
28
|
+
pos="109.25,748.11 163.88,761.95 291.51,794.27 346.09,808.1"];
|
|
29
|
+
b -- c [_draw_="c 7 -#000000 B 4 232.58 900.73 263.2 881.75 321.07 845.87 351.58 826.95 ",
|
|
30
|
+
pos="232.58,900.73 263.2,881.75 321.07,845.87 351.58,826.95"];
|
|
31
|
+
d [_draw_="c 7 -#000000 e 489.49 432.48 27 18 ",
|
|
32
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 489.49 428.28 0 7 1 -d ",
|
|
33
|
+
height=0.5,
|
|
34
|
+
pos="489.49,432.48,81.66",
|
|
35
|
+
width=0.75];
|
|
36
|
+
c -- d [_draw_="c 7 -#000000 B 4 377.11 796.64 396.91 732.46 464.18 514.47 483.97 450.36 ",
|
|
37
|
+
pos="377.11,796.64 396.91,732.46 464.18,514.47 483.97,450.36"];
|
|
38
|
+
e [_draw_="c 7 -#000000 e 153.23 270.14 27 18 ",
|
|
39
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 153.23 265.94 0 6.21 1 -e ",
|
|
40
|
+
height=0.5,
|
|
41
|
+
pos="153.23,270.14,-15.197",
|
|
42
|
+
width=0.75];
|
|
43
|
+
d -- e [_draw_="c 7 -#000000 B 4 467.16 421.7 406 392.17 236.22 310.21 175.32 280.81 ",
|
|
44
|
+
pos="467.16,421.7 406,392.17 236.22,310.21 175.32,280.81"];
|
|
45
|
+
e -- a [_draw_="c 7 -#000000 B 4 150.54 288.34 139.49 363.31 97.52 647.9 86.41 723.25 ",
|
|
46
|
+
pos="150.54,288.34 139.49,363.31 97.523,647.9 86.413,723.25"];
|
|
47
|
+
f [_draw_="c 7 -#000000 e 27 18 27 18 ",
|
|
48
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 27 13.8 0 4.66 1 -f ",
|
|
49
|
+
height=0.5,
|
|
50
|
+
pos="27,18,-107.52",
|
|
51
|
+
width=0.75];
|
|
52
|
+
e -- f [_draw_="c 7 -#000000 B 4 144.55 252.81 121.49 206.75 58.87 81.65 35.74 35.45 ",
|
|
53
|
+
pos="144.55,252.81 121.49,206.75 58.866,81.653 35.737,35.452"];
|
|
54
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Given a 1-D layout, construct a graph where close nodes in this layout are
|
|
5
|
+
* adjacent. The only caller is `iterativePCA_1D`, on at least two nodes, with a
|
|
6
|
+
* graph that always has weights, so C's `n == 0` and `graph[0].ewgts == NULL`
|
|
7
|
+
* guards cannot fire here. C's heap capacity and reserved edge space are array
|
|
8
|
+
* growth here.
|
|
9
|
+
*
|
|
10
|
+
* @see lib/neatogen/closest.c
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { crand } from '../../common/crand.js';
|
|
14
|
+
import { gvQsort } from '../../util/bsd-qsort.js';
|
|
15
|
+
import type { VtxData } from './dijkstra.js';
|
|
16
|
+
|
|
17
|
+
/** Two nodes in the 1-D layout. @see lib/neatogen/closest.c:Pair */
|
|
18
|
+
interface Pair {
|
|
19
|
+
readonly left: number;
|
|
20
|
+
readonly right: number;
|
|
21
|
+
/** Distance between the nodes in the layout. */
|
|
22
|
+
readonly dist: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** An auxiliary heap for finding the closest pair. @see lib/neatogen/closest.c:PairHeap */
|
|
26
|
+
interface PairHeap {
|
|
27
|
+
data: Pair[];
|
|
28
|
+
heapSize: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* `LT(i, j) || (EQ(i, j) && rand() % 2)`: ties draw from the libc stream.
|
|
33
|
+
* @see lib/neatogen/closest.c:greaterPriority
|
|
34
|
+
*/
|
|
35
|
+
function greaterPriority(h: PairHeap, i: number, j: number): boolean {
|
|
36
|
+
const a = h.data[i]!.dist;
|
|
37
|
+
const b = h.data[j]!.dist;
|
|
38
|
+
return a < b || (a === b && crand() % 2 !== 0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** @see lib/util/gv_math.h:SWAP */
|
|
42
|
+
function swap(h: PairHeap, i: number, j: number): void {
|
|
43
|
+
const t = h.data[i]!;
|
|
44
|
+
h.data[i] = h.data[j]!;
|
|
45
|
+
h.data[j] = t;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Children are `2*i` and `2*i+1` from a 0-based root, as C's macros, so the root
|
|
50
|
+
* is its own left child and the comparison with itself still draws.
|
|
51
|
+
* @see lib/neatogen/closest.c:heapify
|
|
52
|
+
*/
|
|
53
|
+
function heapify(h: PairHeap, start: number): void {
|
|
54
|
+
let i = start;
|
|
55
|
+
for (;;) {
|
|
56
|
+
const l = 2 * i;
|
|
57
|
+
const r = 2 * i + 1;
|
|
58
|
+
let largest = l < h.heapSize && greaterPriority(h, l, i) ? l : i;
|
|
59
|
+
if (r < h.heapSize && greaterPriority(h, r, largest)) largest = r;
|
|
60
|
+
if (largest === i) break;
|
|
61
|
+
swap(h, largest, i);
|
|
62
|
+
i = largest;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** @see lib/neatogen/closest.c:initHeap */
|
|
67
|
+
function initHeap(place: Float64Array, ordering: readonly number[], n: number): PairHeap {
|
|
68
|
+
const h: PairHeap = { data: [], heapSize: n - 1 };
|
|
69
|
+
for (let i = 0; i < n - 1; i++) {
|
|
70
|
+
const left = ordering[i]!;
|
|
71
|
+
const right = ordering[i + 1]!;
|
|
72
|
+
h.data.push({ left, right, dist: place[right]! - place[left]! });
|
|
73
|
+
}
|
|
74
|
+
for (let j = Math.trunc((n - 1) / 2); j >= 0; j--) heapify(h, j);
|
|
75
|
+
return h;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** @see lib/neatogen/closest.c:extractMax */
|
|
79
|
+
function extractMax(h: PairHeap): Pair | null {
|
|
80
|
+
if (h.heapSize === 0) return null;
|
|
81
|
+
const max = h.data[0]!;
|
|
82
|
+
h.data[0] = h.data[h.heapSize - 1]!;
|
|
83
|
+
h.heapSize--;
|
|
84
|
+
heapify(h, 0);
|
|
85
|
+
return max;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** @see lib/neatogen/closest.c:insert */
|
|
89
|
+
function insert(h: PairHeap, edge: Pair): void {
|
|
90
|
+
let i = h.heapSize;
|
|
91
|
+
h.heapSize++;
|
|
92
|
+
h.data[i] = edge;
|
|
93
|
+
while (i > 0 && greaterPriority(h, i, Math.trunc(i / 2))) {
|
|
94
|
+
swap(h, i, Math.trunc(i / 2));
|
|
95
|
+
i = Math.trunc(i / 2);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** What `find_closest_pairs` tracks while extracting. */
|
|
100
|
+
interface PairScan {
|
|
101
|
+
readonly place: Float64Array;
|
|
102
|
+
readonly n: number;
|
|
103
|
+
readonly ordering: readonly number[];
|
|
104
|
+
readonly invOrdering: Int32Array;
|
|
105
|
+
/** The leftmost neighbour of each node entered into the heap. */
|
|
106
|
+
readonly left: Int32Array;
|
|
107
|
+
/** The rightmost neighbour of each node entered into the heap. */
|
|
108
|
+
readonly right: Int32Array;
|
|
109
|
+
readonly heap: PairHeap;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Insert to the heap the "descendant" pairs of an extracted pair.
|
|
114
|
+
* @see lib/neatogen/closest.c:find_closest_pairs
|
|
115
|
+
*/
|
|
116
|
+
function insertDescendants(s: PairScan, pair: Pair): void {
|
|
117
|
+
const { place, ordering, invOrdering, left, right, heap } = s;
|
|
118
|
+
const leftIndex = invOrdering[pair.left]!;
|
|
119
|
+
const rightIndex = invOrdering[pair.right]!;
|
|
120
|
+
if (leftIndex > 0) {
|
|
121
|
+
const neighbor = ordering[leftIndex - 1]!;
|
|
122
|
+
if (invOrdering[right[neighbor]!]! < rightIndex) { // we have a new pair
|
|
123
|
+
insert(heap, { left: neighbor, right: pair.right, dist: place[pair.right]! - place[neighbor]! });
|
|
124
|
+
right[neighbor] = pair.right;
|
|
125
|
+
left[pair.right] = neighbor;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (rightIndex < s.n - 1) {
|
|
129
|
+
const neighbor = ordering[rightIndex + 1]!;
|
|
130
|
+
if (invOrdering[left[neighbor]!]! > leftIndex) { // we have a new pair
|
|
131
|
+
insert(heap, { left: pair.left, right: neighbor, dist: place[neighbor]! - place[pair.left]! });
|
|
132
|
+
left[neighbor] = pair.left;
|
|
133
|
+
right[pair.left] = neighbor;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Order the nodes by place, with libc qsort's permutation of ties. @see lib/neatogen/closest.c:cmp */
|
|
139
|
+
function orderByPlace(place: Float64Array, n: number): number[] {
|
|
140
|
+
const ordering = Array.from({ length: n }, (_, i) => i);
|
|
141
|
+
return gvQsort(ordering, (x, y) => {
|
|
142
|
+
if (place[x]! < place[y]!) return -1;
|
|
143
|
+
if (place[x]! > place[y]!) return 1;
|
|
144
|
+
return 0;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The `numPairs` closest pairs in the 1-D layout `place`, as a stack.
|
|
150
|
+
* @see lib/neatogen/closest.c:find_closest_pairs
|
|
151
|
+
*/
|
|
152
|
+
export function findClosestPairs(place: Float64Array, n: number, numPairs: number): Pair[] {
|
|
153
|
+
const ordering = orderByPlace(place, n);
|
|
154
|
+
const invOrdering = new Int32Array(n);
|
|
155
|
+
for (let i = 0; i < n; i++) invOrdering[ordering[i]!] = i;
|
|
156
|
+
const left = new Int32Array(n);
|
|
157
|
+
const right = new Int32Array(n);
|
|
158
|
+
const heap = initHeap(place, ordering, n);
|
|
159
|
+
for (let i = 1; i < n; i++) left[ordering[i]!] = ordering[i - 1]!;
|
|
160
|
+
for (let i = 0; i < n - 1; i++) right[ordering[i]!] = ordering[i + 1]!;
|
|
161
|
+
|
|
162
|
+
const scan: PairScan = { place, n, ordering, invOrdering, left, right, heap };
|
|
163
|
+
const stack: Pair[] = [];
|
|
164
|
+
for (let i = 0; i < numPairs; i++) {
|
|
165
|
+
const pair = extractMax(heap);
|
|
166
|
+
if (pair === null) break; // not enough pairs
|
|
167
|
+
stack.push(pair);
|
|
168
|
+
insertDescendants(scan, pair);
|
|
169
|
+
}
|
|
170
|
+
return stack;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** @see lib/neatogen/closest.c:add_edge */
|
|
174
|
+
function addEdge(graph: VtxData[], u: number, v: number): void {
|
|
175
|
+
const gu = graph[u]!;
|
|
176
|
+
const gv = graph[v]!;
|
|
177
|
+
if (gu.edges.includes(v)) return; // edge already exists
|
|
178
|
+
gu.edges.push(v);
|
|
179
|
+
gu.ewgts.push(1);
|
|
180
|
+
gu.nedges++;
|
|
181
|
+
gv.edges.push(u);
|
|
182
|
+
gv.ewgts.push(1);
|
|
183
|
+
gv.nedges++;
|
|
184
|
+
gu.ewgts[0]!--;
|
|
185
|
+
gv.ewgts[0]!--;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* An unweighted graph of the popped edges, each node's self loop first.
|
|
190
|
+
* @see lib/neatogen/closest.c:construct_graph
|
|
191
|
+
*/
|
|
192
|
+
function constructGraph(n: number, edgesStack: Pair[]): VtxData[] {
|
|
193
|
+
const graph: VtxData[] = Array.from({ length: n }, (_, i) => ({ nedges: 1, edges: [i], ewgts: [0] }));
|
|
194
|
+
for (let top = edgesStack.length - 1; top >= 0; top--) {
|
|
195
|
+
addEdge(graph, edgesStack[top]!.left, edgesStack[top]!.right);
|
|
196
|
+
}
|
|
197
|
+
return graph;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* A graph with edges between the `numPairs` closest pairs in the 1-D space `place`.
|
|
202
|
+
* @see lib/neatogen/closest.c:closest_pairs2graph
|
|
203
|
+
*/
|
|
204
|
+
export function closestPairs2Graph(place: Float64Array, n: number, numPairs: number): VtxData[] {
|
|
205
|
+
return constructGraph(n, findClosestPairs(place, n, numPairs));
|
|
206
|
+
}
|
|
@@ -14,12 +14,11 @@
|
|
|
14
14
|
* @see lib/neatogen/constrained_majorization.c
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { fma } from '../../common/fma.js';
|
|
18
|
-
import { RenderError } from '../../errors.js';
|
|
19
17
|
import type { Node } from '../../model/node.js';
|
|
20
18
|
import { conjugateGradientMkernelFused, rightMultWithVectorFFFused } from './conjgrad-mkernel.js';
|
|
21
19
|
import { computeHierarchy, type Hierarchy } from './compute-hierarchy.js';
|
|
22
20
|
import type { VtxData } from './dijkstra.js';
|
|
21
|
+
import { MODEL_SUBSET } from './init.js';
|
|
23
22
|
import {
|
|
24
23
|
invertSqrtVec, invertVec, orthog1, sqrtVecF, squareVec, vectorsInnerProductF,
|
|
25
24
|
} from './matrix-ops.js';
|
|
@@ -31,6 +30,7 @@ import {
|
|
|
31
30
|
import { imdsGivenDim } from './smart-ini-x.js';
|
|
32
31
|
import { computeApspPacked, initLayout, stressMajorizationKDMkernel } from './stress-kernel.js';
|
|
33
32
|
import { modelDistances, stressModelDij } from './stress-models.js';
|
|
33
|
+
import { distanceKD } from './stress-subspace.js';
|
|
34
34
|
import { OPT_SMART_INIT, TOLERANCE_CG } from './stress.js';
|
|
35
35
|
|
|
36
36
|
const fr = Math.fround;
|
|
@@ -77,15 +77,9 @@ interface KdOpts {
|
|
|
77
77
|
epsilon: number;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
/** Throw where C runs an initialisation this port does not have. */
|
|
81
|
-
function unsupported(what: string): never {
|
|
82
|
-
throw new RenderError(`hierarchical stress majorization: ${what} is not supported yet`, 'UNSUPPORTED_FEATURE');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
80
|
/**
|
|
86
81
|
* `stress_majorization_kD_mkernel`: the distance matrix per model, then the
|
|
87
|
-
* ported kernel
|
|
88
|
-
* which is not ported.
|
|
82
|
+
* ported kernel, which takes `smart_ini` through the subspace estimate.
|
|
89
83
|
* @see lib/neatogen/stress.c:stress_majorization_kD_mkernel
|
|
90
84
|
*/
|
|
91
85
|
function unconstrainedMajorization(
|
|
@@ -93,9 +87,9 @@ function unconstrainedMajorization(
|
|
|
93
87
|
): number {
|
|
94
88
|
if (o.maxi < 0) return 0;
|
|
95
89
|
const Dij = stressModelDij(graph, n, o.model);
|
|
96
|
-
if ((o.opts & OPT_SMART_INIT) !== 0 && n > 1) unsupported('the smart initial layout');
|
|
97
90
|
return stressMajorizationKDMkernel(Dij, n, dCoords, nodes, {
|
|
98
91
|
dim: o.dim, opts: o.opts, maxi: o.maxi, epsilon: o.epsilon,
|
|
92
|
+
smart: { graph, reweightGraph: o.model === MODEL_SUBSET },
|
|
99
93
|
});
|
|
100
94
|
}
|
|
101
95
|
|
|
@@ -174,19 +168,6 @@ function plainInitLayers(
|
|
|
174
168
|
return h === null ? -1 : h;
|
|
175
169
|
}
|
|
176
170
|
|
|
177
|
-
/**
|
|
178
|
-
* Euclidean distance between nodes `i` and `j` in `dim` dimensions.
|
|
179
|
-
* @see lib/neatogen/kkutils.c:distance_kD
|
|
180
|
-
*/
|
|
181
|
-
function distanceKD(coords: Float64Array[], dim: number, i: number, j: number): number {
|
|
182
|
-
let sum = 0;
|
|
183
|
-
for (let k = 0; k < dim; k++) {
|
|
184
|
-
const d = coords[k]![i]! - coords[k]![j]!;
|
|
185
|
-
sum = fma(d, d, sum);
|
|
186
|
-
}
|
|
187
|
-
return Math.sqrt(sum);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
171
|
/**
|
|
191
172
|
* For numerical stability, scale the layout down (no jiggling: it might
|
|
192
173
|
* conflict with the constraints).
|