@knowvah/dot-engine 2.8.1 → 2.10.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/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-gencode.d.ts.map +1 -1
- package/dist/common/poly-init.d.ts +9 -8
- package/dist/common/poly-init.d.ts.map +1 -1
- package/dist/common/safefile.d.ts +38 -0
- package/dist/common/safefile.d.ts.map +1 -0
- package/dist/common/shapes.d.ts +6 -6
- package/dist/common/shapes.d.ts.map +1 -1
- package/dist/gvc/device.d.ts.map +1 -1
- package/dist/gvc/image-resolver.d.ts +5 -0
- package/dist/gvc/image-resolver.d.ts.map +1 -1
- package/dist/gvc/image-type.d.ts +41 -0
- package/dist/gvc/image-type.d.ts.map +1 -0
- package/dist/gvc/render-usershape.d.ts +8 -0
- package/dist/gvc/render-usershape.d.ts.map +1 -1
- package/dist/gvc/usershape.d.ts +25 -1
- package/dist/gvc/usershape.d.ts.map +1 -1
- package/dist/index.js +9179 -7729
- package/dist/index.js.map +4 -4
- 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.d.ts +124 -0
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc.d.ts.map +1 -0
- package/dist/layout/neato/__fixtures__/stress-models.d.ts +39 -0
- package/dist/layout/neato/__fixtures__/stress-models.d.ts.map +1 -0
- package/dist/layout/neato/circuit.d.ts +48 -0
- package/dist/layout/neato/circuit.d.ts.map +1 -0
- package/dist/layout/neato/constrained-majorization.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 +3 -2
- package/dist/layout/neato/init.d.ts.map +1 -1
- package/dist/layout/neato/ipsep-opts.d.ts +19 -0
- package/dist/layout/neato/ipsep-opts.d.ts.map +1 -0
- 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/lu.d.ts +35 -0
- package/dist/layout/neato/lu.d.ts.map +1 -0
- package/dist/layout/neato/matinv.d.ts +8 -0
- package/dist/layout/neato/matinv.d.ts.map +1 -0
- package/dist/layout/neato/quad-prog-vpsc-overlap.d.ts +35 -0
- package/dist/layout/neato/quad-prog-vpsc-overlap.d.ts.map +1 -0
- package/dist/layout/neato/quad-prog-vpsc.d.ts +110 -0
- package/dist/layout/neato/quad-prog-vpsc.d.ts.map +1 -0
- package/dist/layout/neato/start.d.ts +11 -9
- package/dist/layout/neato/start.d.ts.map +1 -1
- package/dist/layout/neato/stress-cola.d.ts +65 -0
- package/dist/layout/neato/stress-cola.d.ts.map +1 -0
- package/dist/layout/neato/stress-kernel.d.ts +0 -2
- package/dist/layout/neato/stress-kernel.d.ts.map +1 -1
- package/dist/layout/neato/stress-models.d.ts +54 -0
- package/dist/layout/neato/stress-models.d.ts.map +1 -0
- package/dist/layout/neato/vpsc-adjust.d.ts +7 -8
- package/dist/layout/neato/vpsc-adjust.d.ts.map +1 -1
- package/dist/render/color-resolve.d.ts +14 -0
- package/dist/render/color-resolve.d.ts.map +1 -1
- package/dist/render/dot/edge-draw.d.ts.map +1 -1
- package/dist/render/svg-arrow-ops.d.ts +21 -4
- package/dist/render/svg-arrow-ops.d.ts.map +1 -1
- package/dist/render/svg-edge-arrows.d.ts +3 -3
- package/dist/render/svg-edge-arrows.d.ts.map +1 -1
- package/dist/render/svg-helpers.d.ts +1 -1
- package/dist/render/svg-helpers.d.ts.map +1 -1
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render.js +9179 -7729
- package/dist/render.js.map +4 -4
- package/dist/vpsc/SweepLine.d.ts +21 -8
- 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 +8 -2
- package/src/common/htmltable.ts +6 -4
- package/src/common/poly-gencode.ts +2 -1
- package/src/common/poly-init.ts +51 -22
- package/src/common/safefile.ts +92 -0
- package/src/common/shapes.ts +43 -22
- package/src/gvc/__fixtures__/p7/colors/98-point.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.json +54 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.svg +17 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.xdot +13 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.json +150 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.svg +30 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.xdot +22 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.json +149 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.json.stderr +0 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.svg +30 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.xdot +21 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.json +149 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.svg +30 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.xdot +21 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/100-rotate.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/100-rotate.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/100-rotate.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.cmapx.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.dot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.json +68 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.json.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.plain.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-png.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-png.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-png.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-png.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-png.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-png.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-png.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-png.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.cmapx.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.dot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.json +68 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.json.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.plain.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.xdot +15 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/bad.png +1 -0
- package/src/gvc/__fixtures__/p7/images/d/r.png +0 -0
- package/src/gvc/__fixtures__/p7/images/d2/r.png +0 -0
- package/src/gvc/__fixtures__/p7/images/g.gif +0 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.gv +10 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.svg +25 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.svg.stderr +3 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.xdot +30 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.xdot.stderr +3 -0
- package/src/gvc/__fixtures__/p7/images/j.jpg +0 -0
- package/src/gvc/__fixtures__/p7/images/r.png +0 -0
- package/src/gvc/__fixtures__/p7/images/s.svg +2 -0
- package/src/gvc/__fixtures__/p7/images/sb.svg +1 -0
- package/src/gvc/__fixtures__/p7/images/t.png +0 -0
- package/src/gvc/__fixtures__/p7/regen.sh +23 -0
- 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/device.ts +11 -4
- package/src/gvc/image-resolver.ts +8 -0
- package/src/gvc/image-type.ts +122 -0
- package/src/gvc/render-usershape.ts +52 -1
- package/src/gvc/usershape.ts +45 -1
- package/src/layout/neato/__fixtures__/ipsep/big-dired.gv +243 -0
- package/src/layout/neato/__fixtures__/ipsep/big-dired.trace +55 -0
- package/src/layout/neato/__fixtures__/ipsep/big-dired.xdot +1832 -0
- package/src/layout/neato/__fixtures__/ipsep/big-dired.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.trace +95 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.xdot +58 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.trace +40 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.xdot +71 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.trace +51 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.xdot +71 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.trace +41 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.xdot +77 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.trace +41 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.xdot +68 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.trace +42 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.xdot +110 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.trace +49 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.xdot +108 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.trace +49 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.xdot +48 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.trace +45 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.xdot +47 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.trace +44 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.xdot +66 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.trace +46 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.trace +52 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.trace +52 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.xdot.stderr +2 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.trace +49 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.trace +211 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.xdot +60 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.trace +50 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.xdot +60 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.trace +51 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.xdot +84 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.xdot.stderr +0 -0
- 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__/quad-prog-vpsc.ts +115 -0
- package/src/layout/neato/__fixtures__/stress-models.ts +64 -0
- package/src/layout/neato/circuit.ts +96 -0
- package/src/layout/neato/constrained-majorization.ts +5 -22
- package/src/layout/neato/index.ts +43 -16
- package/src/layout/neato/init.ts +31 -44
- package/src/layout/neato/ipsep-opts.ts +158 -0
- 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/lu.ts +189 -0
- package/src/layout/neato/matinv.ts +37 -0
- package/src/layout/neato/quad-prog-vpsc-overlap.ts +365 -0
- package/src/layout/neato/quad-prog-vpsc.ts +416 -0
- package/src/layout/neato/start.ts +24 -84
- package/src/layout/neato/stress-cola.ts +497 -0
- package/src/layout/neato/stress-kernel.ts +1 -17
- package/src/layout/neato/stress-models.ts +208 -0
- package/src/layout/neato/vpsc-adjust.ts +35 -66
- package/src/layout/pack/index.ts +2 -2
- package/src/render/color-resolve.ts +25 -2
- package/src/render/dot/edge-draw.ts +7 -4
- package/src/render/svg-arrow-ops.ts +35 -19
- package/src/render/svg-edge-arrows.ts +7 -6
- package/src/render/svg-helpers.ts +19 -11
- package/src/render/svg.ts +15 -3
- package/src/vpsc/SweepLine.ts +39 -26
- package/src/vpsc/sweepTypes.ts +13 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: EPL-2.0
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Helpers of neatogen/kkutils.c: the all-pairs
|
|
5
|
-
* (`compute_apsp
|
|
6
|
-
*
|
|
4
|
+
* Helpers of neatogen/kkutils.c: the neighbour-vector helpers, the all-pairs
|
|
5
|
+
* shortest-path matrices (`compute_apsp`, `compute_apsp_artificial_weights`),
|
|
6
|
+
* the reweighting they use (`compute_new_weights`, `restore_old_weights`) and
|
|
7
|
+
* the index sorts `quicksort_place` and `quicksort_placef`. The sorts go through `gv_sort`, i.e. libc `qsort`, which is
|
|
7
8
|
* not stable: tied keys keep the permutation the BSD/Apple qsort gives, so the
|
|
8
9
|
* sort runs through `gvQsort` (the reproduction of that algorithm).
|
|
9
10
|
*
|
|
@@ -16,6 +17,46 @@ import { bfs } from './bfs.js';
|
|
|
16
17
|
import { ngdijkstra } from './dijkstra.js';
|
|
17
18
|
import type { VtxData } from './dijkstra.js';
|
|
18
19
|
|
|
20
|
+
/** 2^64: C `size_t` arithmetic wraps modulo this. */
|
|
21
|
+
const SIZE_T_MODULUS = 2 ** 64;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Count the neighbours of `u` marked in `vVector`.
|
|
25
|
+
* @see lib/neatogen/kkutils.c:common_neighbors
|
|
26
|
+
*/
|
|
27
|
+
export function commonNeighbors(graph: readonly VtxData[], u: number, vVector: Int32Array): number {
|
|
28
|
+
// count number of common neighbors of 'v_vector' and 'u'
|
|
29
|
+
let numSharedNeighbors = 0;
|
|
30
|
+
for (let j = 1; j < graph[u]!.nedges; j++) {
|
|
31
|
+
const neighbor = graph[u]!.edges[j]!;
|
|
32
|
+
if (vVector[neighbor]! > 0) {
|
|
33
|
+
// a shared neighbor
|
|
34
|
+
numSharedNeighbors++;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return numSharedNeighbors;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Mark the neighbours of `vtx` (a node is NOT a neighbour of itself).
|
|
42
|
+
* @see lib/neatogen/kkutils.c:fill_neighbors_vec_unweighted
|
|
43
|
+
*/
|
|
44
|
+
export function fillNeighborsVecUnweighted(graph: readonly VtxData[], vtx: number, vtxVec: Int32Array): void {
|
|
45
|
+
for (let j = 1; j < graph[vtx]!.nedges; j++) {
|
|
46
|
+
vtxVec[graph[vtx]!.edges[j]!] = 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Clear the marks set by `fillNeighborsVecUnweighted`.
|
|
52
|
+
* @see lib/neatogen/kkutils.c:empty_neighbors_vec
|
|
53
|
+
*/
|
|
54
|
+
export function emptyNeighborsVec(graph: readonly VtxData[], vtx: number, vtxVec: Int32Array): void {
|
|
55
|
+
for (let j = 1; j < graph[vtx]!.nedges; j++) {
|
|
56
|
+
vtxVec[graph[vtx]!.edges[j]!] = 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
19
60
|
/** Three-way compare of two keys; 0 on tie or NaN, as C's `<`/`>` chain. */
|
|
20
61
|
function compareKeys(a: number, b: number): number {
|
|
21
62
|
if (a < b) return -1;
|
|
@@ -94,3 +135,67 @@ function computeApspSimple(graph: VtxData[], n: number): Int32Array[] {
|
|
|
94
135
|
export function computeApsp(graph: VtxData[], n: number): Int32Array[] {
|
|
95
136
|
return graph[0]!.ewgts.length > 0 ? computeApspDijkstra(graph, n) : computeApspSimple(graph, n);
|
|
96
137
|
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The artificial weight of edge (i, neighbor): `deg_i + deg_j - 2 * common`
|
|
141
|
+
* in C `size_t`, so a negative value (only possible with duplicate
|
|
142
|
+
* neighbours) wraps modulo 2^64 before the (float) cast.
|
|
143
|
+
* @see lib/neatogen/kkutils.c:compute_new_weights (kkutils.c:186-188)
|
|
144
|
+
* @see lib/neatogen/stress.c:compute_apsp_artificial_weights_packed (stress.c:735-736, 752-753)
|
|
145
|
+
*/
|
|
146
|
+
export function artificialWeight(graph: readonly VtxData[], degI: number, neighbor: number, vtxVec: Int32Array): number {
|
|
147
|
+
const degJ = graph[neighbor]!.nedges - 1;
|
|
148
|
+
const w = degI + degJ - 2 * commonNeighbors(graph, neighbor, vtxVec);
|
|
149
|
+
return Math.fround(w < 0 ? w + SIZE_T_MODULUS : w);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Reweight the graph so that high degree nodes will be separated. C walks a
|
|
154
|
+
* pointer through one buffer of sum(nedges) floats; the port allocates each
|
|
155
|
+
* vertex's slice.
|
|
156
|
+
* @see lib/neatogen/kkutils.c:compute_new_weights
|
|
157
|
+
*/
|
|
158
|
+
export function computeNewWeights(graph: VtxData[], n: number): void {
|
|
159
|
+
const vtxVec = new Int32Array(n);
|
|
160
|
+
for (let i = 0; i < n; i++) {
|
|
161
|
+
const weights = new Array<number>(graph[i]!.nedges).fill(0);
|
|
162
|
+
graph[i]!.ewgts = weights;
|
|
163
|
+
fillNeighborsVecUnweighted(graph, i, vtxVec);
|
|
164
|
+
const degI = graph[i]!.nedges - 1;
|
|
165
|
+
for (let j = 1; j <= degI; j++) {
|
|
166
|
+
const neighbor = graph[i]!.edges[j]!;
|
|
167
|
+
weights[j] = artificialWeight(graph, degI, neighbor, vtxVec);
|
|
168
|
+
}
|
|
169
|
+
emptyNeighborsVec(graph, i, vtxVec);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Drop the new weights and give the caller's back. C's `old_weights` is the one
|
|
175
|
+
* block it walks by `nedges`; the port's is one array per vertex, `null` for C
|
|
176
|
+
* `NULL`. With `null` only graph[0].ewgts is cleared, so graph[1..n-1].ewgts
|
|
177
|
+
* keep the new weights (C: dangling pointers into the freed buffer).
|
|
178
|
+
* @see lib/neatogen/kkutils.c:restore_old_weights
|
|
179
|
+
*/
|
|
180
|
+
export function restoreOldWeights(graph: VtxData[], n: number, oldWeights: readonly number[][] | null): void {
|
|
181
|
+
graph[0]!.ewgts = []; // free(graph[0].ewgts); graph[0].ewgts = NULL
|
|
182
|
+
if (oldWeights !== null) {
|
|
183
|
+
for (let i = 0; i < n; i++) {
|
|
184
|
+
graph[i]!.ewgts = oldWeights[i]!;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* All-pairs shortest-path lengths as `DistType` (int) rows while weighting the
|
|
191
|
+
* graph so high-degree nodes are distantly located: always Dijkstra, over the
|
|
192
|
+
* int-truncated new weights.
|
|
193
|
+
* @see lib/neatogen/kkutils.c:compute_apsp_artificial_weights
|
|
194
|
+
*/
|
|
195
|
+
export function computeApspArtificialWeights(graph: VtxData[], n: number): Int32Array[] {
|
|
196
|
+
const oldWeights = graph[0]!.ewgts.length === 0 ? null : graph.slice(0, n).map((v) => v.ewgts);
|
|
197
|
+
computeNewWeights(graph, n);
|
|
198
|
+
const Dij = computeApspDijkstra(graph, n);
|
|
199
|
+
restoreOldWeights(graph, n, oldWeights);
|
|
200
|
+
return Dij;
|
|
201
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Linear equations (Ax = b) by LU decomposition with partial pivoting and row
|
|
5
|
+
* equilibration (Ken Turkowski). `luDecompose` factors the coefficient matrix;
|
|
6
|
+
* `luSolve` solves against one unit vector per call.
|
|
7
|
+
*
|
|
8
|
+
* Floating point follows the oracle's clang -O3 arm64 code (16.1.0
|
|
9
|
+
* `libgvplugin_neato_layout`): the elimination `lu[i][j] -= mult * lu[k][j]`
|
|
10
|
+
* is fused (fmla/fmsub), and `luSolve`'s dot products are vectorised 8 terms
|
|
11
|
+
* at a time as fmul + in-order fadd (unfused) with a fused (fmadd) scalar tail.
|
|
12
|
+
*
|
|
13
|
+
* @see lib/neatogen/lu.c
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { fma } from '../../common/fma.js';
|
|
17
|
+
import { fmaxf as fmax } from './quad-prog-solve.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* State for an LU decomposition. `null` is a freed (or never allocated) field.
|
|
21
|
+
* @see lib/neatogen/neato.h:lu_t
|
|
22
|
+
*/
|
|
23
|
+
export interface LuT {
|
|
24
|
+
/** Composite of the upper and lower triangular matrices. */
|
|
25
|
+
lu: Float64Array[] | null;
|
|
26
|
+
/** Pivot sequence. */
|
|
27
|
+
ps: Int32Array | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** clang's vector width for `luSolve`'s dot products (4 x 2 doubles). */
|
|
31
|
+
const DOT_VECTOR_TERMS = 8;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* An m x n array of rows over one buffer, every entry `ival`.
|
|
35
|
+
* Lives here (not in a stuff.c port) because lu.c is its first ported caller.
|
|
36
|
+
* @see lib/neatogen/stuff.c:new_array
|
|
37
|
+
*/
|
|
38
|
+
export function newArray(m: number, n: number, ival: number): Float64Array[] {
|
|
39
|
+
const mem = new Float64Array(m * n);
|
|
40
|
+
const rv: Float64Array[] = [];
|
|
41
|
+
for (let i = 0; i < m; i++) {
|
|
42
|
+
rv.push(mem.subarray(i * n, (i + 1) * n));
|
|
43
|
+
rv[i]!.fill(ival);
|
|
44
|
+
}
|
|
45
|
+
return rv;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Copy `a` into `lu.lu`, record 1/largest per row in `scales` and the identity
|
|
50
|
+
* pivot sequence; false on a zero row (C returns 0 there).
|
|
51
|
+
* @see lib/neatogen/lu.c:lu_decompose (lu.c:74-86)
|
|
52
|
+
*/
|
|
53
|
+
function luScaleRows(lu: LuT, a: readonly ArrayLike<number>[], n: number, scales: Float64Array): boolean {
|
|
54
|
+
const m = lu.lu!;
|
|
55
|
+
const ps = lu.ps!;
|
|
56
|
+
for (let i = 0; i < n; i++) { // for each row
|
|
57
|
+
/* Find the largest element in each row for row equilibration */
|
|
58
|
+
let biggest = 0;
|
|
59
|
+
for (let j = 0; j < n; j++) biggest = fmax(biggest, Math.abs((m[i]![j] = a[i]![j]!)));
|
|
60
|
+
if (biggest > 0.0) scales[i] = 1.0 / biggest;
|
|
61
|
+
else return false; /* Zero row: singular matrix */
|
|
62
|
+
ps[i] = i; // initialize pivot sequence
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The scaled-largest row index at or below `k` in column `k`, or -1 when the
|
|
69
|
+
* column is zero. `pivotindex` carries over between columns, as in C.
|
|
70
|
+
* @see lib/neatogen/lu.c:lu_decompose (lu.c:88-102)
|
|
71
|
+
*/
|
|
72
|
+
function luFindPivot(lu: LuT, k: number, n: number, scales: Float64Array, pivotindex: number): number {
|
|
73
|
+
const m = lu.lu!;
|
|
74
|
+
const ps = lu.ps!;
|
|
75
|
+
/* Find the largest element in each column to pivot around */
|
|
76
|
+
let biggest = 0;
|
|
77
|
+
for (let i = k; i < n; i++) {
|
|
78
|
+
const tempf = Math.abs(m[ps[i]!]![k]!) * scales[ps[i]!]!;
|
|
79
|
+
if (biggest < tempf) {
|
|
80
|
+
biggest = tempf;
|
|
81
|
+
pivotindex = i;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (biggest <= 0.0) return -1; /* Zero column: singular matrix */
|
|
85
|
+
return pivotindex;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Pivot on column `k`, eliminating an extra variable (fused multiply-subtract).
|
|
90
|
+
* @see lib/neatogen/lu.c:lu_decompose (lu.c:107-113)
|
|
91
|
+
*/
|
|
92
|
+
function luEliminate(lu: LuT, k: number, n: number): void {
|
|
93
|
+
const m = lu.lu!;
|
|
94
|
+
const ps = lu.ps!;
|
|
95
|
+
const rowK = m[ps[k]!]!;
|
|
96
|
+
const pivot = rowK[k]!;
|
|
97
|
+
for (let i = k + 1; i < n; i++) {
|
|
98
|
+
const rowI = m[ps[i]!]!;
|
|
99
|
+
const mult = (rowI[k] = rowI[k]! / pivot);
|
|
100
|
+
for (let j = k + 1; j < n; j++) rowI[j] = fma(-mult, rowK[j]!, rowI[j]!);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Decompose the n x n matrix `a` into `lu`. 1 on success; 0 (with `lu` freed)
|
|
106
|
+
* when `a` is singular. n = 0 reads `ps[-1]` in C (undefined behaviour); no
|
|
107
|
+
* caller reaches it (stress_majorization_cola returns early for one node).
|
|
108
|
+
* @see lib/neatogen/lu.c:lu_decompose
|
|
109
|
+
*/
|
|
110
|
+
export function luDecompose(lu: LuT, a: readonly ArrayLike<number>[], n: number): 0 | 1 {
|
|
111
|
+
lu.lu = newArray(n, n, 0.0);
|
|
112
|
+
lu.ps = new Int32Array(n);
|
|
113
|
+
const scales = new Float64Array(n);
|
|
114
|
+
|
|
115
|
+
if (!luScaleRows(lu, a, n, scales)) {
|
|
116
|
+
luFree(lu);
|
|
117
|
+
return 0; /* Zero row: singular matrix */
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
for (let k = 0, pivotindex = 0; k < n - 1; k++) { // for each column
|
|
121
|
+
pivotindex = luFindPivot(lu, k, n, scales, pivotindex);
|
|
122
|
+
if (pivotindex < 0) {
|
|
123
|
+
luFree(lu);
|
|
124
|
+
return 0; /* Zero column: singular matrix */
|
|
125
|
+
}
|
|
126
|
+
if (pivotindex !== k) { /* Update pivot sequence */
|
|
127
|
+
const ps = lu.ps;
|
|
128
|
+
const t = ps[k]!;
|
|
129
|
+
ps[k] = ps[pivotindex]!;
|
|
130
|
+
ps[pivotindex] = t;
|
|
131
|
+
}
|
|
132
|
+
/* Pivot, eliminating an extra variable each time */
|
|
133
|
+
luEliminate(lu, k, n);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (lu.lu[lu.ps[n - 1]!]![n - 1] === 0.0) {
|
|
137
|
+
luFree(lu);
|
|
138
|
+
return 0; /* Singular matrix */
|
|
139
|
+
}
|
|
140
|
+
return 1;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* `sum row[j] * x[j]` for j in [from, to), as clang emits it: the first
|
|
145
|
+
* 8-multiple of terms as fmul + in-order fadd, the rest fused.
|
|
146
|
+
* @see lib/neatogen/lu.c:lu_solve (lu.c:140-141, 147-148)
|
|
147
|
+
*/
|
|
148
|
+
function luDot(row: Float64Array, x: Float64Array, from: number, to: number): number {
|
|
149
|
+
const vecEnd = from + (to - from) - ((to - from) % DOT_VECTOR_TERMS);
|
|
150
|
+
let dot = 0;
|
|
151
|
+
let j = from;
|
|
152
|
+
for (; j < vecEnd; j++) dot += row[j]! * x[j]!;
|
|
153
|
+
for (; j < to; j++) dot = fma(row[j]!, x[j]!, dot);
|
|
154
|
+
return dot;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Solve A x = e_bi with the decomposition from `luDecompose`.
|
|
159
|
+
* @see lib/neatogen/lu.c:lu_solve
|
|
160
|
+
*/
|
|
161
|
+
export function luSolve(lu: LuT, x: Float64Array, bi: number, n: number): void {
|
|
162
|
+
const m = lu.lu!;
|
|
163
|
+
const ps = lu.ps!;
|
|
164
|
+
/* Vector reduction using U triangular matrix */
|
|
165
|
+
for (let i = 0; i < n; i++) {
|
|
166
|
+
const dot = luDot(m[ps[i]!]!, x, 0, i);
|
|
167
|
+
x[i] = (ps[i] === bi ? 1 : 0) - dot;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* Back substitution, in L triangular matrix */
|
|
171
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
172
|
+
const row = m[ps[i]!]!;
|
|
173
|
+
const dot = luDot(row, x, i + 1, n);
|
|
174
|
+
x[i] = (x[i]! - dot) / row[i]!;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Release the decomposition. C frees without clearing the pointers; the port
|
|
180
|
+
* drops them to `null`.
|
|
181
|
+
* @see lib/neatogen/lu.c:lu_free
|
|
182
|
+
*/
|
|
183
|
+
export function luFree(lu: LuT | null): void {
|
|
184
|
+
if (lu === null) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
lu.lu = null;
|
|
188
|
+
lu.ps = null;
|
|
189
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Matrix inversion by LU decomposition (Ken Turkowski).
|
|
5
|
+
* @see lib/neatogen/matinv.c
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { luDecompose, luSolve, luFree, type LuT } from './lu.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Invert the leading n x n block of `A` into `Ainv`: solve for one row of
|
|
12
|
+
* `Ainv` per unit vector, then transpose. 1 on success, 0 when singular
|
|
13
|
+
* (`Ainv` untouched).
|
|
14
|
+
* @see lib/neatogen/matinv.c:matinv
|
|
15
|
+
*/
|
|
16
|
+
export function matinv(A: readonly ArrayLike<number>[], Ainv: Float64Array[], n: number): 0 | 1 {
|
|
17
|
+
/* Decompose matrix into L and U triangular matrices */
|
|
18
|
+
const lu: LuT = { lu: null, ps: null };
|
|
19
|
+
if (luDecompose(lu, A, n) === 0) return 0; // singular
|
|
20
|
+
|
|
21
|
+
/* Invert matrix by solving n simultaneous equations n times */
|
|
22
|
+
for (let i = 0; i < n; i++) {
|
|
23
|
+
luSolve(lu, Ainv[i]!, i, n); // into a row of Ainv: fix later
|
|
24
|
+
}
|
|
25
|
+
luFree(lu);
|
|
26
|
+
|
|
27
|
+
/* Transpose matrix */
|
|
28
|
+
for (let i = 0; i < n; i++) {
|
|
29
|
+
for (let j = 0; j < i; j++) {
|
|
30
|
+
const t = Ainv[i]![j]!;
|
|
31
|
+
Ainv[i]![j] = Ainv[j]![i]!;
|
|
32
|
+
Ainv[j]![i] = t;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return 1;
|
|
37
|
+
}
|