@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
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The subset and circuit distance models of stress majorization, and the choice
|
|
5
|
+
* of `Dij` among them. The kkutils.c neighbour-vector helpers they use live in
|
|
6
|
+
* kkutils.ts, re-exported here.
|
|
7
|
+
* `circuitModel` here is stress.c's (float `Dij` from `vtx_data`); `circuit.ts`'s
|
|
8
|
+
* `circuitModel` is circuit.c's `circuit_model` (`GD_dist` from a graph, KK path).
|
|
9
|
+
*
|
|
10
|
+
* `Dij` is C `float` (Float32Array); the circuit matrices are C `double`.
|
|
11
|
+
* C `NULL` ewgts is the port's empty array.
|
|
12
|
+
*
|
|
13
|
+
* @see lib/neatogen/stress.c
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import type { VtxData } from './dijkstra.js';
|
|
17
|
+
import { agerr, agwarningf } from '../../common/agerr.js';
|
|
18
|
+
import { computeApspPacked, computeWeightedApspPacked } from './bfs.js';
|
|
19
|
+
import { solveCircuit } from './circuit.js';
|
|
20
|
+
import { MODEL_CIRCUIT, MODEL_MDS, MODEL_SUBSET } from './init.js';
|
|
21
|
+
import { artificialWeight, emptyNeighborsVec, fillNeighborsVecUnweighted } from './kkutils.js';
|
|
22
|
+
import { newArray } from './lu.js';
|
|
23
|
+
import { fmaxf } from './quad-prog-solve.js';
|
|
24
|
+
import { mdsModel } from './stress.js';
|
|
25
|
+
|
|
26
|
+
export { commonNeighbors, emptyNeighborsVec, fillNeighborsVecUnweighted } from './kkutils.js';
|
|
27
|
+
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
// circuitModel
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Distances from the resistor circuit: Dij = Ginv[i][i] + Ginv[j][j] -
|
|
34
|
+
* 2 Ginv[i][j] over the inverted conductance matrix; `null` (C `NULL`) when
|
|
35
|
+
* `solveCircuit` fails, e.g. on a disconnected graph.
|
|
36
|
+
* @see lib/neatogen/stress.c:circuitModel
|
|
37
|
+
*/
|
|
38
|
+
export function circuitModel(graph: readonly VtxData[], nG: number): Float32Array | null {
|
|
39
|
+
let Dij: Float32Array | null = new Float32Array((nG * (nG + 1)) / 2);
|
|
40
|
+
const Gm = newArray(nG, nG, 0.0);
|
|
41
|
+
const GmInv = newArray(nG, nG, 0.0);
|
|
42
|
+
|
|
43
|
+
/* set non-diagonal entries */
|
|
44
|
+
if (graph[0]!.ewgts.length !== 0) {
|
|
45
|
+
for (let i = 0; i < nG; i++) {
|
|
46
|
+
for (let e = 1; e < graph[i]!.nedges; e++) {
|
|
47
|
+
const j = graph[i]!.edges[e]!;
|
|
48
|
+
/* conductance is 1/resistance; ewgts is C float */
|
|
49
|
+
Gm[i]![j] = Gm[j]![i] = -1.0 / Math.fround(graph[i]!.ewgts[e]!); /* negate */
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
for (let i = 0; i < nG; i++) {
|
|
54
|
+
for (let e = 1; e < graph[i]!.nedges; e++) {
|
|
55
|
+
const j = graph[i]!.edges[e]!;
|
|
56
|
+
/* conductance is 1/resistance */
|
|
57
|
+
Gm[i]![j] = Gm[j]![i] = -1.0; /* ewgts are all 1 */
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const rv = solveCircuit(nG, Gm, GmInv);
|
|
63
|
+
|
|
64
|
+
if (rv) {
|
|
65
|
+
circuitDistances(GmInv, nG, Dij);
|
|
66
|
+
} else {
|
|
67
|
+
Dij = null;
|
|
68
|
+
}
|
|
69
|
+
return Dij;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Fill the packed `Dij` from the inverted conductance matrix.
|
|
74
|
+
* @see lib/neatogen/stress.c:circuitModel (stress.c:197-209)
|
|
75
|
+
*/
|
|
76
|
+
function circuitDistances(GmInv: readonly Float64Array[], nG: number, Dij: Float32Array): void {
|
|
77
|
+
let count = 0;
|
|
78
|
+
for (let i = 0; i < nG; i++) {
|
|
79
|
+
for (let j = i; j < nG; j++) {
|
|
80
|
+
// the Float32Array store is C's (float) cast
|
|
81
|
+
Dij[count++] = i === j ? 0.0 : GmInv[i]![i]! + GmInv[j]![j]! - 2.0 * GmInv[i]![j]!;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// compute_apsp_artificial_weights_packed
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Weighted branch: each weight is fmaxf(artificial, the caller's ewgts[j]),
|
|
92
|
+
* read from graph[i].ewgts before graph[i].ewgts is reassigned.
|
|
93
|
+
* @see lib/neatogen/stress.c:compute_apsp_artificial_weights_packed (stress.c:730-743)
|
|
94
|
+
*/
|
|
95
|
+
function weightGraphKeepingLengths(graph: VtxData[], n: number, vtxVec: Int32Array): void {
|
|
96
|
+
for (let i = 0; i < n; i++) {
|
|
97
|
+
const weights = new Array<number>(graph[i]!.nedges).fill(0);
|
|
98
|
+
fillNeighborsVecUnweighted(graph, i, vtxVec);
|
|
99
|
+
const degI = graph[i]!.nedges - 1;
|
|
100
|
+
for (let j = 1; j <= degI; j++) {
|
|
101
|
+
const neighbor = graph[i]!.edges[j]!;
|
|
102
|
+
weights[j] = fmaxf(artificialWeight(graph, degI, neighbor, vtxVec), Math.fround(graph[i]!.ewgts[j]!));
|
|
103
|
+
}
|
|
104
|
+
emptyNeighborsVec(graph, i, vtxVec);
|
|
105
|
+
graph[i]!.ewgts = weights;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Unweighted branch: graph[i].ewgts is pointed at the new weights first.
|
|
111
|
+
* @see lib/neatogen/stress.c:compute_apsp_artificial_weights_packed (stress.c:745-758)
|
|
112
|
+
*/
|
|
113
|
+
function weightGraph(graph: VtxData[], n: number, vtxVec: Int32Array): void {
|
|
114
|
+
for (let i = 0; i < n; i++) {
|
|
115
|
+
const weights = new Array<number>(graph[i]!.nedges).fill(0);
|
|
116
|
+
graph[i]!.ewgts = weights;
|
|
117
|
+
fillNeighborsVecUnweighted(graph, i, vtxVec);
|
|
118
|
+
const degI = graph[i]!.nedges - 1;
|
|
119
|
+
for (let j = 1; j <= degI; j++) {
|
|
120
|
+
const neighbor = graph[i]!.edges[j]!;
|
|
121
|
+
weights[j] = artificialWeight(graph, degI, neighbor, vtxVec);
|
|
122
|
+
}
|
|
123
|
+
emptyNeighborsVec(graph, i, vtxVec);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* All-pairs shortest paths after weighting every edge so that high-degree
|
|
129
|
+
* nodes sit far apart: Dijkstra when the graph carries ewgts, else bfs over
|
|
130
|
+
* the (int-truncated) artificial weights.
|
|
131
|
+
*
|
|
132
|
+
* The C allocates one buffer of sum(nedges) floats and walks a pointer
|
|
133
|
+
* through it; the port allocates each vertex's slice. On return
|
|
134
|
+
* graph[0].ewgts is NULL; when the caller had ewgts every vertex gets its
|
|
135
|
+
* original array back, otherwise graph[1..n-1].ewgts keep the artificial
|
|
136
|
+
* weights (C: dangling pointers into the freed buffer).
|
|
137
|
+
* @see lib/neatogen/stress.c:compute_apsp_artificial_weights_packed
|
|
138
|
+
*/
|
|
139
|
+
export function computeApspArtificialWeightsPacked(graph: VtxData[], n: number): Float32Array {
|
|
140
|
+
/* compute all-pairs-shortest-path-length while weighting the graph */
|
|
141
|
+
/* so high-degree nodes are distantly located */
|
|
142
|
+
const oldWeights = graph[0]!.ewgts;
|
|
143
|
+
// C walks old_weights by graph[i].nedges; the port keeps each vertex's array
|
|
144
|
+
const savedWeights = graph.slice(0, n).map((v) => v.ewgts);
|
|
145
|
+
const vtxVec = new Int32Array(n);
|
|
146
|
+
|
|
147
|
+
let Dij: Float32Array;
|
|
148
|
+
if (graph[0]!.ewgts.length !== 0) {
|
|
149
|
+
weightGraphKeepingLengths(graph, n, vtxVec);
|
|
150
|
+
Dij = computeWeightedApspPacked(graph, n);
|
|
151
|
+
} else {
|
|
152
|
+
weightGraph(graph, n, vtxVec);
|
|
153
|
+
Dij = computeApspPacked(graph, n);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
graph[0]!.ewgts = []; // free(graph[0].ewgts); graph[0].ewgts = NULL
|
|
157
|
+
if (oldWeights.length !== 0) {
|
|
158
|
+
for (let i = 0; i < n; i++) {
|
|
159
|
+
graph[i]!.ewgts = savedWeights[i]!;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return Dij;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
// Dij selection
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The model branches C writes twice, with the same shape: subset, circuit
|
|
171
|
+
* (warning when it fails), mds. `null` is C's `Dij` still NULL, where each
|
|
172
|
+
* caller picks its own shortest paths. `model` is the defs.h numbering of
|
|
173
|
+
* init.ts, not stress.ts's.
|
|
174
|
+
* @see lib/neatogen/stress.c:stress_majorization_kD_mkernel (stress.c:837-852)
|
|
175
|
+
* @see lib/neatogen/constrained_majorization.c:stress_majorization_with_hierarchy (173-186)
|
|
176
|
+
*/
|
|
177
|
+
export function modelDistances(graph: VtxData[], n: number, model: number): Float32Array | null {
|
|
178
|
+
let Dij: Float32Array | null = null;
|
|
179
|
+
if (model === MODEL_SUBSET) {
|
|
180
|
+
/* weight graph to separate high-degree nodes */
|
|
181
|
+
/* and perform slower Dijkstra-based computation */
|
|
182
|
+
Dij = computeApspArtificialWeightsPacked(graph, n);
|
|
183
|
+
} else if (model === MODEL_CIRCUIT) {
|
|
184
|
+
Dij = circuitModel(graph, n);
|
|
185
|
+
if (Dij === null) {
|
|
186
|
+
agwarningf('graph is disconnected. Hence, the circuit model');
|
|
187
|
+
agerr('prev', 'is undefined. Reverting to the shortest path model.');
|
|
188
|
+
}
|
|
189
|
+
} else if (model === MODEL_MDS) {
|
|
190
|
+
Dij = mdsModel(graph, n);
|
|
191
|
+
}
|
|
192
|
+
return Dij;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The all-pairs-shortest-distances block of `stress_majorization_kD_mkernel`:
|
|
197
|
+
* the model's matrix, else shortest paths, weighted iff `graph->ewgts`.
|
|
198
|
+
*
|
|
199
|
+
* Boundary deviation: C computes this inside the kernel, after its `maxi < 0`
|
|
200
|
+
* return. The port's fused kernel takes `Dij` as a parameter, so the caller runs
|
|
201
|
+
* this first and owns that check (part-8 AD-2).
|
|
202
|
+
* @see lib/neatogen/stress.c:stress_majorization_kD_mkernel (stress.c:833-859)
|
|
203
|
+
*/
|
|
204
|
+
export function stressModelDij(graph: VtxData[], n: number, model: number): Float32Array {
|
|
205
|
+
const Dij = modelDistances(graph, n, model);
|
|
206
|
+
if (Dij !== null) return Dij;
|
|
207
|
+
return graph[0]!.ewgts.length !== 0 ? computeWeightedApspPacked(graph, n) : computeApspPacked(graph, n);
|
|
208
|
+
}
|
|
@@ -4,90 +4,59 @@
|
|
|
4
4
|
* `overlap=vpsc`: the VPSC adjuster of removeOverlapWith, moved out of
|
|
5
5
|
* neato/index.ts so every engine reaches it through the shared dispatch.
|
|
6
6
|
*
|
|
7
|
-
* C works on `float` coordinates (`float *coords[2]`)
|
|
8
|
-
* to float on entry and
|
|
9
|
-
* between the x and y passes.
|
|
7
|
+
* C works on `float` coordinates (`float *coords[2]`): positions are rounded
|
|
8
|
+
* to float on entry, and `removeoverlaps` stores each pass's result as float,
|
|
9
|
+
* which decides exact-touch verdicts between the x and y passes.
|
|
10
10
|
*
|
|
11
11
|
* @see lib/neatogen/adjust.c:vpscAdjust
|
|
12
|
-
* @see lib/neatogen/quad_prog_vpsc.c:removeoverlaps
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
14
|
import type { Graph } from '../../model/graph.js';
|
|
16
|
-
import {
|
|
17
|
-
newVariable,
|
|
18
|
-
deleteVariable,
|
|
19
|
-
deleteVPSC,
|
|
20
|
-
deleteConstraints,
|
|
21
|
-
solveVPSC,
|
|
22
|
-
genXConstraints,
|
|
23
|
-
genYConstraints,
|
|
24
|
-
VPSC,
|
|
25
|
-
Rectangle,
|
|
26
|
-
type Variable,
|
|
27
|
-
} from '../../vpsc/index.js';
|
|
28
15
|
import { sepFactor, DFLT_MARGIN } from './sep-factor.js';
|
|
16
|
+
import type { ClusterData, IpsepOptions } from './quad-prog-vpsc.js';
|
|
17
|
+
import { removeoverlaps } from './quad-prog-vpsc-overlap.js';
|
|
29
18
|
|
|
30
19
|
const POINTS_PER_INCH = 72;
|
|
31
|
-
/** Widen nodes in the x pass so a horizontally resolved pair does not count as
|
|
32
|
-
* vertically overlapping. @see quad_prog_vpsc.c:generateNonoverlapConstraints */
|
|
33
|
-
const X_PASS_SCALE = Math.fround(1.0001);
|
|
34
20
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
function buildRects(c: Coords, size: VpscBox[], gap: Gap, scale: number): Rectangle[] {
|
|
42
|
-
return size.map((s, i) => {
|
|
43
|
-
const hw = (scale * s.w) / 2.0 + gap.x / 2.0;
|
|
44
|
-
const hh = (scale * s.h) / 2.0 + gap.y / 2.0;
|
|
45
|
-
return new Rectangle(c[0][i]! - hw, c[0][i]! + hw, c[1][i]! - hh, c[1][i]! + hh);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** Solve one axis and store the result (rounded to float) into `c[axis]`.
|
|
50
|
-
* @see lib/neatogen/quad_prog_vpsc.c:removeoverlaps */
|
|
51
|
-
function solveAxis(c: Coords, size: VpscBox[], gap: Gap, axis: 0 | 1): void {
|
|
52
|
-
const rects = buildRects(c, size, gap, axis === 0 ? X_PASS_SCALE : 1);
|
|
53
|
-
const vars: Variable[] = size.map((_, i) => newVariable(i, 1.0, 1.0));
|
|
54
|
-
const cs = axis === 0 ? genXConstraints(rects, vars, true) : genYConstraints(rects, vars);
|
|
55
|
-
const vpsc = new VPSC(vars, cs);
|
|
56
|
-
solveVPSC(vpsc);
|
|
57
|
-
// solveVPSC places every variable in a block. @see quad_prog_vpsc.c:568 getVariablePos
|
|
58
|
-
vars.forEach((v, i) => {
|
|
59
|
-
c[axis][i] = v.position();
|
|
60
|
-
});
|
|
61
|
-
deleteVPSC(vpsc);
|
|
62
|
-
deleteConstraints(cs);
|
|
63
|
-
for (const v of vars) deleteVariable(v);
|
|
21
|
+
/** `(cluster_data){0}`. @see lib/neatogen/adjust.c:vpscAdjust */
|
|
22
|
+
function noClusters(): ClusterData {
|
|
23
|
+
return {
|
|
24
|
+
nvars: 0, nclusters: 0, clustersizes: new Int32Array(0), clusters: [],
|
|
25
|
+
ntoplevel: 0, toplevel: new Int32Array(0), bb: [],
|
|
26
|
+
};
|
|
64
27
|
}
|
|
65
28
|
|
|
66
29
|
/**
|
|
67
|
-
* Remove overlaps with two VPSC passes
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
30
|
+
* Remove overlaps with `removeoverlaps` (two VPSC passes, x then y). The gap
|
|
31
|
+
* is twice the separation margin (opt.gap is the gap size, not the margin):
|
|
32
|
+
* `2 * sep` when `sep` is additive, else twice DFLT_MARGIN. Returns 0 as C
|
|
33
|
+
* does.
|
|
71
34
|
* @see lib/neatogen/adjust.c:vpscAdjust
|
|
72
35
|
*/
|
|
73
36
|
export function vpscAdjust(g: Graph): number {
|
|
74
|
-
const margin = sepFactor(g);
|
|
75
|
-
const gap: Gap = {
|
|
76
|
-
x: (2 * (margin.doAdd ? margin.x : DFLT_MARGIN)) / POINTS_PER_INCH,
|
|
77
|
-
y: (2 * (margin.doAdd ? margin.y : DFLT_MARGIN)) / POINTS_PER_INCH,
|
|
78
|
-
};
|
|
79
37
|
const nodes = Array.from(g.nodes.values());
|
|
80
|
-
const
|
|
38
|
+
const coords = [new Float32Array(nodes.length), new Float32Array(nodes.length)];
|
|
81
39
|
// Layout has set ND_pos and node init ND_width/ND_height before any adjuster.
|
|
82
|
-
nodes.forEach((n,
|
|
83
|
-
|
|
84
|
-
|
|
40
|
+
nodes.forEach((n, j) => {
|
|
41
|
+
coords[0]![j] = n.info.pos![0];
|
|
42
|
+
coords[1]![j] = n.info.pos![1];
|
|
85
43
|
});
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
44
|
+
const margin = sepFactor(g);
|
|
45
|
+
/* Multiply by 2 since opt.gap is the gap size, not the margin */
|
|
46
|
+
const opt: IpsepOptions = {
|
|
47
|
+
diredges: 0,
|
|
48
|
+
edgeGap: 0,
|
|
49
|
+
noverlap: 2,
|
|
50
|
+
clusters: noClusters(),
|
|
51
|
+
gap: {
|
|
52
|
+
x: 2.0 * ((margin.doAdd ? margin.x : DFLT_MARGIN) / POINTS_PER_INCH),
|
|
53
|
+
y: 2.0 * ((margin.doAdd ? margin.y : DFLT_MARGIN) / POINTS_PER_INCH),
|
|
54
|
+
},
|
|
55
|
+
nsize: nodes.map((n) => ({ x: n.info.width!, y: n.info.height! })),
|
|
56
|
+
};
|
|
57
|
+
removeoverlaps(nodes.length, coords, opt);
|
|
58
|
+
nodes.forEach((n, j) => {
|
|
59
|
+
n.info.pos = [coords[0]![j]!, coords[1]![j]!];
|
|
91
60
|
});
|
|
92
61
|
return 0;
|
|
93
62
|
}
|
package/src/layout/pack/index.ts
CHANGED
|
@@ -452,14 +452,14 @@ export function pccomps(g: Graph, pfx: string): { graphs: Graph[]; pinned: boole
|
|
|
452
452
|
pinned = true;
|
|
453
453
|
}
|
|
454
454
|
if (pinnedNodes.length > 0) {
|
|
455
|
-
result.push(buildSubgraph(g, pinnedNodes, `${pfx}
|
|
455
|
+
result.push(buildSubgraph(g, pinnedNodes, `${pfx}${idx++}`));
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
// Pass 2 — remaining components in node order.
|
|
459
459
|
for (const n of g.nodes.values()) {
|
|
460
460
|
if (visited.has(n.name)) continue;
|
|
461
461
|
const comp = dfsCollect(g, n, visited);
|
|
462
|
-
result.push(buildSubgraph(g, comp, `${pfx}
|
|
462
|
+
result.push(buildSubgraph(g, comp, `${pfx}${idx++}`));
|
|
463
463
|
}
|
|
464
464
|
return { graphs: result, pinned };
|
|
465
465
|
}
|
|
@@ -132,8 +132,31 @@ export function resolveRenderColor(raw: string, report = true): GVColor {
|
|
|
132
132
|
* @see lib/gvc/gvrender.c:456 gvrender_set_fillcolor
|
|
133
133
|
*/
|
|
134
134
|
export function resolveFillColorName(raw: string, report = true): GVColor {
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
// A colour list is cut at the first ':' for the lookup; a known name keeps
|
|
136
|
+
// its stored pointer into the (restored) full string, so svg (the renderer
|
|
137
|
+
// with a known-colors list) prints "red:"; xdot translates the cut name.
|
|
138
|
+
const colon = raw.indexOf(':');
|
|
139
|
+
const name = colon < 0 ? raw : raw.slice(0, colon);
|
|
140
|
+
if (name === 'none') return { type: 'none' };
|
|
141
|
+
const color = resolveColorName(name, report);
|
|
142
|
+
return color.type === 'string' && rendererColors.hasKnownList ? { type: 'string', s: raw } : color;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The edge fill colour emit_edge_graphics hands to gvrender_set_fillcolor, or
|
|
147
|
+
* undefined for the semicolon multicolor path (which `goto done`s before any
|
|
148
|
+
* fill is chosen and fills each segment with its own colour). `color` is the
|
|
149
|
+
* edge's color attribute ("" when unset); the fill is `late_nnstring(e,
|
|
150
|
+
* E_fillcolor, color)`, and an empty result is DEFAULT_COLOR. `report` is
|
|
151
|
+
* false when no fill was set and `color` is a list (that name is only used
|
|
152
|
+
* piecewise, by the per-segment pen colours).
|
|
153
|
+
* @see lib/common/emit.c:2397-2434,2541-2547 emit_edge_graphics
|
|
154
|
+
*/
|
|
155
|
+
export function edgeFillName(color: string, fillcolor: string | undefined): { name: string; report: boolean } | undefined {
|
|
156
|
+
if (color.includes(';') && color.includes(':')) return undefined;
|
|
157
|
+
const set = fillcolor !== undefined && fillcolor !== '';
|
|
158
|
+
const name = set ? fillcolor : color;
|
|
159
|
+
return { name: name === '' ? 'black' : name, report: set || !color.includes(':') };
|
|
137
160
|
}
|
|
138
161
|
|
|
139
162
|
function resolveColorName(raw: string, report: boolean): GVColor {
|
|
@@ -41,14 +41,14 @@ const DEFAULT_LINE_STYLE: readonly string[] = ['solid', 'setlinewidth(1)'];
|
|
|
41
41
|
* the four cases and their `filled` variants are exactly arrow_gen's.
|
|
42
42
|
* @see lib/common/arrows.c arrow_gen
|
|
43
43
|
*/
|
|
44
|
-
function emitArrowOp(buf: string[], op: ArrowDrawOp,
|
|
44
|
+
function emitArrowOp(buf: string[], op: ArrowDrawOp, fill: GVColor): void {
|
|
45
45
|
switch (op.kind) {
|
|
46
46
|
case 'polygon':
|
|
47
|
-
if (op.filled) buf.push(xdotFillColor(
|
|
47
|
+
if (op.filled) buf.push(xdotFillColor(fill));
|
|
48
48
|
buf.push(xdotPoints(op.filled ? 'P' : 'p', op.points));
|
|
49
49
|
break;
|
|
50
50
|
case 'ellipse':
|
|
51
|
-
if (op.filled) buf.push(xdotFillColor(
|
|
51
|
+
if (op.filled) buf.push(xdotFillColor(fill));
|
|
52
52
|
buf.push(
|
|
53
53
|
(op.filled ? 'E ' : 'e ') + xdotPoint(op.center) +
|
|
54
54
|
xdotNum(op.rx) + ' ' + xdotNum(op.ry) + ' ',
|
|
@@ -217,6 +217,9 @@ export abstract class EdgeDrawBase extends DotWriterBase {
|
|
|
217
217
|
const pen = penOverride !== undefined
|
|
218
218
|
? resolveRenderColor(penOverride)
|
|
219
219
|
: job.obj?.penColor ?? { type: 'string', s: 'black' };
|
|
220
|
+
// arrow_gen paints with the current fillcolor: the segment colour on the
|
|
221
|
+
// multicolor paths (penOverride), else emit_edge_graphics' edge fill.
|
|
222
|
+
const fill = penOverride !== undefined ? pen : job.obj?.fillColor ?? pen;
|
|
220
223
|
const pw = job.obj?.penWidth ?? 1;
|
|
221
224
|
for (const op of ops) {
|
|
222
225
|
if (Math.abs(pw - this.penwidth[state]!) >= 0.0005) {
|
|
@@ -225,7 +228,7 @@ export abstract class EdgeDrawBase extends DotWriterBase {
|
|
|
225
228
|
}
|
|
226
229
|
buf.push(xdotStrOp('S ', 'solid'));
|
|
227
230
|
buf.push(xdotPenColor(pen));
|
|
228
|
-
emitArrowOp(buf, op,
|
|
231
|
+
emitArrowOp(buf, op, fill);
|
|
229
232
|
}
|
|
230
233
|
}
|
|
231
234
|
}
|
|
@@ -31,14 +31,21 @@ function emitArrowOpacity(job: RenderJob, attr: string, opacity: string | null):
|
|
|
31
31
|
if (opacity !== null) job.write(' ' + attr + '="' + opacity + '"');
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* The paint an arrow primitive is drawn with: the stroke (pen) and the fill
|
|
36
|
+
* colour with their stringified alphas (null when opaque).
|
|
37
|
+
* @see lib/common/arrows.c:arrow_gen
|
|
38
|
+
*/
|
|
39
|
+
export interface ArrowInk { pen: string; penOpacity: string | null; fill: string; fillOpacity: string | null }
|
|
40
|
+
|
|
34
41
|
/** `<polygon>` with Adobe first-point repetition (matches svg_polygon). */
|
|
35
|
-
function emitPolygonOp(points: Point[], filled: boolean,
|
|
42
|
+
function emitPolygonOp(points: Point[], filled: boolean, ink: ArrowInk, job: RenderJob, pw: number): void {
|
|
36
43
|
const pts = points.map((p) => transformPoint(p, job));
|
|
37
|
-
job.write('<polygon fill="' + (filled ?
|
|
38
|
-
if (filled) emitArrowOpacity(job, 'fill-opacity',
|
|
39
|
-
job.write(' stroke="' +
|
|
44
|
+
job.write('<polygon fill="' + (filled ? ink.fill : 'none') + '"');
|
|
45
|
+
if (filled) emitArrowOpacity(job, 'fill-opacity', ink.fillOpacity);
|
|
46
|
+
job.write(' stroke="' + ink.pen + '"');
|
|
40
47
|
emitArrowPenWidth(job, pw);
|
|
41
|
-
emitArrowOpacity(job, 'stroke-opacity',
|
|
48
|
+
emitArrowOpacity(job, 'stroke-opacity', ink.penOpacity);
|
|
42
49
|
job.write(' points="');
|
|
43
50
|
emitPoints(job, pts);
|
|
44
51
|
if (pts.length > 0) {
|
|
@@ -55,13 +62,13 @@ function emitPolygonOp(points: Point[], filled: boolean, penColor: string, job:
|
|
|
55
62
|
interface EllipseOp { center: Point; rx: number; ry: number; filled: boolean }
|
|
56
63
|
|
|
57
64
|
/** `<ellipse>` (dot/odot). rx/ry are emitted in layout units (device scale 1). */
|
|
58
|
-
function emitEllipseOp(op: EllipseOp,
|
|
65
|
+
function emitEllipseOp(op: EllipseOp, ink: ArrowInk, job: RenderJob, pw: number): void {
|
|
59
66
|
const c = transformPoint(op.center, job);
|
|
60
|
-
job.write('<ellipse fill="' + (op.filled ?
|
|
61
|
-
if (op.filled) emitArrowOpacity(job, 'fill-opacity',
|
|
62
|
-
job.write(' stroke="' +
|
|
67
|
+
job.write('<ellipse fill="' + (op.filled ? ink.fill : 'none') + '"');
|
|
68
|
+
if (op.filled) emitArrowOpacity(job, 'fill-opacity', ink.fillOpacity);
|
|
69
|
+
job.write(' stroke="' + ink.pen + '"');
|
|
63
70
|
emitArrowPenWidth(job, pw);
|
|
64
|
-
emitArrowOpacity(job, 'stroke-opacity',
|
|
71
|
+
emitArrowOpacity(job, 'stroke-opacity', ink.penOpacity);
|
|
65
72
|
job.write(' cx="');
|
|
66
73
|
job.printDouble(c.x);
|
|
67
74
|
job.write('" cy="');
|
|
@@ -96,18 +103,27 @@ function emitBezierOp(points: Point[], penColor: string, job: RenderJob, pw: num
|
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
/**
|
|
99
|
-
* Emit one edge end's arrowhead draw-ops, in order, with the given
|
|
100
|
-
*
|
|
101
|
-
* is opaque; it drives the SVG fill/stroke-opacity attributes (e.g. an edge
|
|
102
|
-
* color="#rrggbbaa"). @see lib/common/arrows.c:arrow_gen
|
|
106
|
+
* Emit one edge end's arrowhead draw-ops, in order, with the given ink.
|
|
107
|
+
* @see lib/common/arrows.c:arrow_gen
|
|
103
108
|
*/
|
|
104
|
-
export function
|
|
109
|
+
export function emitArrowOpsInk(ops: ArrowDrawOp[], ink: ArrowInk, job: RenderJob, pw: number): void {
|
|
105
110
|
for (const op of ops) {
|
|
106
111
|
switch (op.kind) {
|
|
107
|
-
case 'polygon': emitPolygonOp(op.points, op.filled,
|
|
108
|
-
case 'ellipse': emitEllipseOp(op,
|
|
109
|
-
case 'polyline': emitPolylineOp(op.points,
|
|
110
|
-
case 'bezier': emitBezierOp(op.points,
|
|
112
|
+
case 'polygon': emitPolygonOp(op.points, op.filled, ink, job, pw); break;
|
|
113
|
+
case 'ellipse': emitEllipseOp(op, ink, job, pw); break;
|
|
114
|
+
case 'polyline': emitPolylineOp(op.points, ink.pen, job, pw, ink.penOpacity); break;
|
|
115
|
+
case 'bezier': emitBezierOp(op.points, ink.pen, job, pw, ink.penOpacity); break;
|
|
111
116
|
}
|
|
112
117
|
}
|
|
113
118
|
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* {@link emitArrowOpsInk} with the pen colour also as the fill (the multicolor
|
|
122
|
+
* paths set fill = segment colour). `opacity` is the stringified alpha
|
|
123
|
+
* (`colorOpacity`) or null when the pen color is opaque; it drives the SVG
|
|
124
|
+
* fill/stroke-opacity attributes (e.g. an edge color="#rrggbbaa").
|
|
125
|
+
* @see lib/common/arrows.c:arrow_gen
|
|
126
|
+
*/
|
|
127
|
+
export function emitArrowOps(ops: ArrowDrawOp[], penColor: string, job: RenderJob, pw: number, opacity: string | null = null): void {
|
|
128
|
+
emitArrowOpsInk(ops, { pen: penColor, penOpacity: opacity, fill: penColor, fillOpacity: opacity }, job, pw);
|
|
129
|
+
}
|
|
@@ -9,10 +9,11 @@ import type { Edge } from '../model/edge.js';
|
|
|
9
9
|
import type { Bezier } from '../model/geom.js';
|
|
10
10
|
import type { RenderJob } from '../gvc/job.js';
|
|
11
11
|
import { bezierEndOps } from '../common/bezier-arrows.js';
|
|
12
|
-
import {
|
|
12
|
+
import { emitArrowOpsInk } from './svg-arrow-ops.js';
|
|
13
|
+
import type { ArrowInk } from './svg-arrow-ops.js';
|
|
13
14
|
|
|
14
|
-
/** The edge pen an arrow is drawn with. */
|
|
15
|
-
export interface ArrowPaint { job: RenderJob;
|
|
15
|
+
/** The edge pen and fill an arrow is drawn with. */
|
|
16
|
+
export interface ArrowPaint { job: RenderJob; ink: ArrowInk; pw: number }
|
|
16
17
|
|
|
17
18
|
/** Which ends have drawn their edge-level arrow. */
|
|
18
19
|
export interface ArrowsDone { tailDone: boolean; headDone: boolean }
|
|
@@ -32,7 +33,7 @@ export function emitBezierEndArrow(
|
|
|
32
33
|
const ops = bezierEndOps(e, bz, end)
|
|
33
34
|
?? (flag !== 0 && !done && edgeOps?.length ? edgeOps : undefined);
|
|
34
35
|
if (ops === undefined) return;
|
|
35
|
-
|
|
36
|
+
emitArrowOpsInk(ops, p.ink, p.job, p.pw);
|
|
36
37
|
if (tail) st.tailDone = true;
|
|
37
38
|
else st.headDone = true;
|
|
38
39
|
}
|
|
@@ -46,9 +47,9 @@ export function emitBezierEndArrow(
|
|
|
46
47
|
*/
|
|
47
48
|
export function emitRemainingArrows(e: Edge, st: ArrowsDone, p: ArrowPaint): void {
|
|
48
49
|
if (!st.tailDone && e.info.tailArrowOps?.length) {
|
|
49
|
-
|
|
50
|
+
emitArrowOpsInk(e.info.tailArrowOps, p.ink, p.job, p.pw);
|
|
50
51
|
}
|
|
51
52
|
if (!st.headDone && e.info.headArrowOps?.length) {
|
|
52
|
-
|
|
53
|
+
emitArrowOpsInk(e.info.headArrowOps, p.ink, p.job, p.pw);
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -32,7 +32,8 @@ import { colorPaint, colorOpacity, textFillAttrs } from './color-resolve.js';
|
|
|
32
32
|
import { PenType, FillType } from '../gvc/context.js';
|
|
33
33
|
import { emitLinearGradient, emitRadialGradient, gradientId } from './svg-gradient.js';
|
|
34
34
|
import { transformPoint } from '../gvc/device.js';
|
|
35
|
-
import {
|
|
35
|
+
import { emitArrowOpsInk } from './svg-arrow-ops.js';
|
|
36
|
+
import type { ArrowInk } from './svg-arrow-ops.js';
|
|
36
37
|
|
|
37
38
|
// ---------------------------------------------------------------------------
|
|
38
39
|
// Module-level constants
|
|
@@ -444,11 +445,7 @@ export function svgEdgePath(e: Edge, job: RenderJob): void {
|
|
|
444
445
|
if (spl === undefined || spl.size === 0) return;
|
|
445
446
|
const obj = job.obj;
|
|
446
447
|
const stroke = obj !== null ? paintStr(obj, false) : 'black';
|
|
447
|
-
const paint: ArrowPaint = {
|
|
448
|
-
job, penColor: stroke,
|
|
449
|
-
opacity: obj !== null ? colorOpacity(obj.penColor) : null,
|
|
450
|
-
pw: obj !== null ? obj.penWidth : 1.0,
|
|
451
|
-
};
|
|
448
|
+
const paint: ArrowPaint = { job, ink: edgeArrowInk(obj), pw: obj !== null ? obj.penWidth : 1.0 };
|
|
452
449
|
const st = { tailDone: false, headDone: false };
|
|
453
450
|
for (let si = 0; si < spl.size; si++) {
|
|
454
451
|
const bz = spl.list[si] as Bezier | undefined;
|
|
@@ -563,21 +560,32 @@ export function emitArrowPolygon(rawPts: Point[], penColor: string, job: RenderJ
|
|
|
563
560
|
job.write('"/>\n');
|
|
564
561
|
}
|
|
565
562
|
|
|
563
|
+
/**
|
|
564
|
+
* The edge's arrow ink: stroke = pen colour, fill = the edge fill colour.
|
|
565
|
+
* @see lib/common/emit.c:2397-2434,2541-2547 emit_edge_graphics
|
|
566
|
+
*/
|
|
567
|
+
function edgeArrowInk(obj: ObjState | null): ArrowInk {
|
|
568
|
+
if (obj === null) return { pen: 'black', penOpacity: null, fill: 'black', fillOpacity: null };
|
|
569
|
+
return {
|
|
570
|
+
pen: paintStr(obj, false), penOpacity: colorOpacity(obj.penColor),
|
|
571
|
+
fill: paintStr(obj, true), fillOpacity: colorOpacity(obj.fillColor),
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
|
|
566
575
|
/**
|
|
567
576
|
* Emit arrowhead polygon(s) for a routed edge (tail first, then head).
|
|
568
|
-
* Arrow
|
|
577
|
+
* Arrow stroke is the edge pen colour and fill the edge fill colour (AD1).
|
|
569
578
|
* @see plugin/core/gvrender_core_svg.c:svg_polygon (arrowhead case)
|
|
570
579
|
* @see lib/common/arrows.c:arrow_type_normal
|
|
571
580
|
*/
|
|
572
581
|
export function svgArrowPolygons(e: Edge, job: RenderJob): void {
|
|
573
582
|
const obj = job.obj;
|
|
574
|
-
const
|
|
575
|
-
const opacity = obj !== null ? colorOpacity(obj.penColor) : null;
|
|
583
|
+
const ink = edgeArrowInk(obj);
|
|
576
584
|
const pw = obj !== null ? obj.penWidth : 1.0;
|
|
577
585
|
const tailOps = e.info.tailArrowOps;
|
|
578
|
-
if (tailOps?.length)
|
|
586
|
+
if (tailOps?.length) emitArrowOpsInk(tailOps, ink, job, pw);
|
|
579
587
|
const headOps = e.info.headArrowOps;
|
|
580
|
-
if (headOps?.length)
|
|
588
|
+
if (headOps?.length) emitArrowOpsInk(headOps, ink, job, pw);
|
|
581
589
|
}
|
|
582
590
|
|
|
583
591
|
// ---------------------------------------------------------------------------
|
package/src/render/svg.ts
CHANGED
|
@@ -248,9 +248,21 @@ export class SvgRenderer implements RendererPlugin {
|
|
|
248
248
|
const found = findImageBytes(src, job.imageResolver);
|
|
249
249
|
if (found !== null) href = toDataUri(found.bytes, found.mime);
|
|
250
250
|
}
|
|
251
|
-
job.write('<image xlink:href="' + escapeXml(href)
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
job.write('<image xlink:href="' + escapeXml(href));
|
|
252
|
+
if (job.rotation !== 0) {
|
|
253
|
+
// FIXME - this is messed up >>>
|
|
254
|
+
job.write('" width="' + g(height) + 'px" height="' + g(width)
|
|
255
|
+
+ 'px" preserveAspectRatio="xMidYMid meet" x="' + g(originx)
|
|
256
|
+
+ '" y="' + g(-originy) + '"');
|
|
257
|
+
job.write(' transform="rotate(' + String(Math.trunc(job.rotation)) + ' '
|
|
258
|
+
+ g(originx) + ' ' + g(-originy) + ')"');
|
|
259
|
+
// <<<
|
|
260
|
+
} else {
|
|
261
|
+
job.write('" width="' + g(width) + 'px" height="' + g(height)
|
|
262
|
+
+ 'px" preserveAspectRatio="xMinYMin meet" x="' + g(originx)
|
|
263
|
+
+ '" y="' + g(-originy) + '"');
|
|
264
|
+
}
|
|
265
|
+
job.write('/>\n');
|
|
254
266
|
}
|
|
255
267
|
|
|
256
268
|
comment(text: string, job: RenderJob): void { svgComment(text, job); }
|