@knowvah/dot-engine 2.10.3 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/dist/common/agerr.d.ts +12 -0
  2. package/dist/common/agerr.d.ts.map +1 -1
  3. package/dist/gvc/context.d.ts.map +1 -1
  4. package/dist/gvc/emit-xdot.d.ts.map +1 -1
  5. package/dist/gvc/layout-reset.d.ts +38 -1
  6. package/dist/gvc/layout-reset.d.ts.map +1 -1
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1260 -387
  10. package/dist/index.js.map +4 -4
  11. package/dist/layout/circo/circular.d.ts.map +1 -1
  12. package/dist/layout/dot/edge-route-chain.d.ts.map +1 -1
  13. package/dist/layout/dot/edge-route-helpers.d.ts +6 -1
  14. package/dist/layout/dot/edge-route-helpers.d.ts.map +1 -1
  15. package/dist/layout/dot/edge-route-rank.d.ts +4 -1
  16. package/dist/layout/dot/edge-route-rank.d.ts.map +1 -1
  17. package/dist/layout/dot/index.d.ts.map +1 -1
  18. package/dist/layout/dot/init.d.ts.map +1 -1
  19. package/dist/layout/fdp/cluster-edges.d.ts +11 -0
  20. package/dist/layout/fdp/cluster-edges.d.ts.map +1 -1
  21. package/dist/layout/neato/closest.d.ts +20 -0
  22. package/dist/layout/neato/closest.d.ts.map +1 -0
  23. package/dist/layout/neato/constrained-majorization.d.ts +13 -0
  24. package/dist/layout/neato/constrained-majorization.d.ts.map +1 -1
  25. package/dist/layout/neato/embed-graph.d.ts +20 -0
  26. package/dist/layout/neato/embed-graph.d.ts.map +1 -0
  27. package/dist/layout/neato/fdp-adjust.d.ts.map +1 -1
  28. package/dist/layout/neato/index.d.ts.map +1 -1
  29. package/dist/layout/neato/init-dim.d.ts +54 -0
  30. package/dist/layout/neato/init-dim.d.ts.map +1 -0
  31. package/dist/layout/neato/init.d.ts +1 -11
  32. package/dist/layout/neato/init.d.ts.map +1 -1
  33. package/dist/layout/neato/kk.d.ts +4 -2
  34. package/dist/layout/neato/kk.d.ts.map +1 -1
  35. package/dist/layout/neato/matrix-ops-dense.d.ts +34 -0
  36. package/dist/layout/neato/matrix-ops-dense.d.ts.map +1 -0
  37. package/dist/layout/neato/pca.d.ts +14 -0
  38. package/dist/layout/neato/pca.d.ts.map +1 -0
  39. package/dist/layout/neato/sgd.d.ts +2 -3
  40. package/dist/layout/neato/sgd.d.ts.map +1 -1
  41. package/dist/layout/neato/start.d.ts +5 -5
  42. package/dist/layout/neato/start.d.ts.map +1 -1
  43. package/dist/layout/neato/stress-kernel.d.ts +10 -2
  44. package/dist/layout/neato/stress-kernel.d.ts.map +1 -1
  45. package/dist/layout/neato/stress-subspace.d.ts +39 -0
  46. package/dist/layout/neato/stress-subspace.d.ts.map +1 -0
  47. package/dist/layout/neato/vpsc-adjust.d.ts.map +1 -1
  48. package/dist/layout/pack/ccomps.d.ts +4 -2
  49. package/dist/layout/pack/ccomps.d.ts.map +1 -1
  50. package/dist/layout/sfdp/index.d.ts.map +1 -1
  51. package/dist/layout/sfdp/init.d.ts +6 -7
  52. package/dist/layout/sfdp/init.d.ts.map +1 -1
  53. package/dist/layout/twopi/circle.d.ts.map +1 -1
  54. package/dist/layout/twopi/index.d.ts.map +1 -1
  55. package/dist/render/dot/attrs.d.ts +7 -0
  56. package/dist/render/dot/attrs.d.ts.map +1 -1
  57. package/dist/render.js +1637 -770
  58. package/dist/render.js.map +4 -4
  59. package/package.json +4 -4
  60. package/src/common/agerr.ts +49 -1
  61. package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.1 +20 -0
  62. package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.2 +20 -0
  63. package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.3 +20 -0
  64. package/src/gvc/__fixtures__/rerender/abom-shift-pack.gv +1 -0
  65. package/src/gvc/__fixtures__/rerender/abom-shift-parity.dot.plain.nofree.1 +22 -0
  66. package/src/gvc/__fixtures__/rerender/abom-shift-parity.dot.plain.nofree.2 +22 -0
  67. package/src/gvc/__fixtures__/rerender/abom-shift-parity.dot.plain.nofree.3 +22 -0
  68. package/src/gvc/__fixtures__/rerender/abom-shift-parity.gv +1 -0
  69. package/src/gvc/__fixtures__/rerender/abom-shift.dot.plain.nofree.1 +13 -0
  70. package/src/gvc/__fixtures__/rerender/abom-shift.dot.plain.nofree.2 +13 -0
  71. package/src/gvc/__fixtures__/rerender/abom-shift.dot.plain.nofree.3 +13 -0
  72. package/src/gvc/__fixtures__/rerender/abom-shift.gv +1 -0
  73. package/src/gvc/__fixtures__/rerender/cluster-edge-splines.fdp.plain.1 +10 -0
  74. package/src/gvc/__fixtures__/rerender/cluster-edge-splines.fdp.plain.2 +11 -0
  75. package/src/gvc/__fixtures__/rerender/cluster-edge-splines.gv +9 -0
  76. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.dot.1 +40 -0
  77. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.dot.2 +40 -0
  78. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.plain.noaddr.1 +15 -0
  79. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.plain.noaddr.2 +17 -0
  80. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-dot-plain.1 +40 -0
  81. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-dot-plain.2 +15 -0
  82. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-dot-svg.1 +40 -0
  83. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-dot-svg.2 +99 -0
  84. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-json-json.1 +489 -0
  85. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-json-json.2 +503 -0
  86. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-nofree-dot-svg.1 +40 -0
  87. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.seq-nofree-dot-svg.2 +109 -0
  88. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.xdot.1 +69 -0
  89. package/src/gvc/__fixtures__/rerender/cluster-edges.fdp.xdot.2 +70 -0
  90. package/src/gvc/__fixtures__/rerender/cluster-edges.gv +15 -0
  91. package/src/gvc/__fixtures__/rerender/fdp-1581.fdp.dot.1 +104 -0
  92. package/src/gvc/__fixtures__/rerender/fdp-1581.fdp.dot.2 +104 -0
  93. package/src/gvc/__fixtures__/rerender/fdp-1581.gv +26 -0
  94. package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.1 +34 -0
  95. package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.2 +34 -0
  96. package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.3 +34 -0
  97. package/src/gvc/__fixtures__/rerender/flat-rev-stale.gv +33 -0
  98. package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.1 +181 -0
  99. package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.2 +218 -0
  100. package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.3 +255 -0
  101. package/src/gvc/__fixtures__/rerender/regen.sh +25 -0
  102. package/src/gvc/context.ts +7 -2
  103. package/src/gvc/emit-xdot.ts +37 -7
  104. package/src/gvc/layout-reset.ts +59 -1
  105. package/src/index.ts +4 -0
  106. package/src/layout/circo/circular.ts +3 -1
  107. package/src/layout/dot/edge-route-chain.ts +79 -7
  108. package/src/layout/dot/edge-route-helpers.ts +8 -2
  109. package/src/layout/dot/edge-route-rank.ts +20 -2
  110. package/src/layout/dot/index.ts +17 -2
  111. package/src/layout/dot/init.ts +9 -17
  112. package/src/layout/dot/splines-flat.ts +12 -12
  113. package/src/layout/dot/splines.ts +2 -2
  114. package/src/layout/fdp/cluster-edges.ts +0 -0
  115. package/src/layout/fdp/index.ts +2 -2
  116. package/src/layout/neato/__fixtures__/dim/circuit-dim3.dot +33 -0
  117. package/src/layout/neato/__fixtures__/dim/circuit-dim3.gv +12 -0
  118. package/src/layout/neato/__fixtures__/dim/circuit-dim3.stderr +0 -0
  119. package/src/layout/neato/__fixtures__/dim/circuit-dim3.xdot +54 -0
  120. package/src/layout/neato/__fixtures__/dim/dim11-dimen11.dot +32 -0
  121. package/src/layout/neato/__fixtures__/dim/dim11-dimen11.gv +11 -0
  122. package/src/layout/neato/__fixtures__/dim/dim11-dimen11.stderr +0 -0
  123. package/src/layout/neato/__fixtures__/dim/dim11-dimen11.xdot +53 -0
  124. package/src/layout/neato/__fixtures__/dim/dim3-dimen3.dot +32 -0
  125. package/src/layout/neato/__fixtures__/dim/dim3-dimen3.gv +11 -0
  126. package/src/layout/neato/__fixtures__/dim/dim3-dimen3.stderr +0 -0
  127. package/src/layout/neato/__fixtures__/dim/dim3-dimen3.xdot +53 -0
  128. package/src/layout/neato/__fixtures__/dim/dim3.dot +31 -0
  129. package/src/layout/neato/__fixtures__/dim/dim3.gv +10 -0
  130. package/src/layout/neato/__fixtures__/dim/dim3.stderr +0 -0
  131. package/src/layout/neato/__fixtures__/dim/dim3.xdot +52 -0
  132. package/src/layout/neato/__fixtures__/dim/dim4-dimen4.dot +32 -0
  133. package/src/layout/neato/__fixtures__/dim/dim4-dimen4.gv +11 -0
  134. package/src/layout/neato/__fixtures__/dim/dim4-dimen4.stderr +0 -0
  135. package/src/layout/neato/__fixtures__/dim/dim4-dimen4.xdot +53 -0
  136. package/src/layout/neato/__fixtures__/dim/dimen3.dot +31 -0
  137. package/src/layout/neato/__fixtures__/dim/dimen3.gv +10 -0
  138. package/src/layout/neato/__fixtures__/dim/dimen3.stderr +0 -0
  139. package/src/layout/neato/__fixtures__/dim/dimen3.xdot +52 -0
  140. package/src/layout/neato/__fixtures__/dim/hier-big-dim3.dot +267 -0
  141. package/src/layout/neato/__fixtures__/dim/hier-big-dim3.gv +84 -0
  142. package/src/layout/neato/__fixtures__/dim/hier-big-dim3.stderr +0 -0
  143. package/src/layout/neato/__fixtures__/dim/hier-big-dim3.xdot +468 -0
  144. package/src/layout/neato/__fixtures__/dim/hier-big-dim4.dot +267 -0
  145. package/src/layout/neato/__fixtures__/dim/hier-big-dim4.gv +84 -0
  146. package/src/layout/neato/__fixtures__/dim/hier-big-dim4.stderr +0 -0
  147. package/src/layout/neato/__fixtures__/dim/hier-big-dim4.xdot +468 -0
  148. package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.dot +268 -0
  149. package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.gv +85 -0
  150. package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.stderr +0 -0
  151. package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.xdot +469 -0
  152. package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.dot +484 -0
  153. package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.gv +151 -0
  154. package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.stderr +0 -0
  155. package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.xdot +852 -0
  156. package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.dot +34 -0
  157. package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.gv +13 -0
  158. package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.stderr +0 -0
  159. package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.xdot +55 -0
  160. package/src/layout/neato/__fixtures__/dim/hier-dim3.dot +33 -0
  161. package/src/layout/neato/__fixtures__/dim/hier-dim3.gv +12 -0
  162. package/src/layout/neato/__fixtures__/dim/hier-dim3.stderr +0 -0
  163. package/src/layout/neato/__fixtures__/dim/hier-dim3.xdot +54 -0
  164. package/src/layout/neato/__fixtures__/dim/hier-dim4.dot +33 -0
  165. package/src/layout/neato/__fixtures__/dim/hier-dim4.gv +12 -0
  166. package/src/layout/neato/__fixtures__/dim/hier-dim4.stderr +0 -0
  167. package/src/layout/neato/__fixtures__/dim/hier-dim4.xdot +54 -0
  168. package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim2.dot +32 -0
  169. package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim2.gv +11 -0
  170. package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim2.stderr +0 -0
  171. package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim2.xdot +53 -0
  172. package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim3.dot +34 -0
  173. package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim3.gv +13 -0
  174. package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim3.stderr +0 -0
  175. package/src/layout/neato/__fixtures__/dim/hier-dirnone-dim3.xdot +55 -0
  176. package/src/layout/neato/__fixtures__/dim/hier-len-dim3.dot +37 -0
  177. package/src/layout/neato/__fixtures__/dim/hier-len-dim3.gv +12 -0
  178. package/src/layout/neato/__fixtures__/dim/hier-len-dim3.stderr +0 -0
  179. package/src/layout/neato/__fixtures__/dim/hier-len-dim3.xdot +58 -0
  180. package/src/layout/neato/__fixtures__/dim/hier-noedge-big.dot +141 -0
  181. package/src/layout/neato/__fixtures__/dim/hier-noedge-big.gv +48 -0
  182. package/src/layout/neato/__fixtures__/dim/hier-noedge-big.stderr +1 -0
  183. package/src/layout/neato/__fixtures__/dim/hier-noedge-big.xdot +233 -0
  184. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim2.dot +21 -0
  185. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim2.gv +8 -0
  186. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim2.stderr +1 -0
  187. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim2.xdot +33 -0
  188. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim3.dot +23 -0
  189. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim3.gv +10 -0
  190. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim3.stderr +1 -0
  191. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim3.xdot +35 -0
  192. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim4.dot +23 -0
  193. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim4.gv +10 -0
  194. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim4.stderr +1 -0
  195. package/src/layout/neato/__fixtures__/dim/hier-noedge-dim4.xdot +35 -0
  196. package/src/layout/neato/__fixtures__/dim/hier-nohier-dim2.dot +26 -0
  197. package/src/layout/neato/__fixtures__/dim/hier-nohier-dim2.gv +7 -0
  198. package/src/layout/neato/__fixtures__/dim/hier-nohier-dim2.stderr +0 -0
  199. package/src/layout/neato/__fixtures__/dim/hier-nohier-dim2.xdot +44 -0
  200. package/src/layout/neato/__fixtures__/dim/hier-nohier-dim3.dot +28 -0
  201. package/src/layout/neato/__fixtures__/dim/hier-nohier-dim3.gv +9 -0
  202. package/src/layout/neato/__fixtures__/dim/hier-nohier-dim3.stderr +0 -0
  203. package/src/layout/neato/__fixtures__/dim/hier-nohier-dim3.xdot +46 -0
  204. package/src/layout/neato/__fixtures__/dim/hier-pack-dim3.dot +48 -0
  205. package/src/layout/neato/__fixtures__/dim/hier-pack-dim3.gv +15 -0
  206. package/src/layout/neato/__fixtures__/dim/hier-pack-dim3.stderr +0 -0
  207. package/src/layout/neato/__fixtures__/dim/hier-pack-dim3.xdot +79 -0
  208. package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.dot +56 -0
  209. package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.gv +17 -0
  210. package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.stderr +0 -0
  211. package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.xdot +94 -0
  212. package/src/layout/neato/__fixtures__/dim/hier-star-dim3.dot +47 -0
  213. package/src/layout/neato/__fixtures__/dim/hier-star-dim3.gv +14 -0
  214. package/src/layout/neato/__fixtures__/dim/hier-star-dim3.stderr +0 -0
  215. package/src/layout/neato/__fixtures__/dim/hier-star-dim3.xdot +78 -0
  216. package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim3.dot +34 -0
  217. package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim3.gv +13 -0
  218. package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim3.stderr +0 -0
  219. package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim3.xdot +55 -0
  220. package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.dot +34 -0
  221. package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.gv +13 -0
  222. package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.stderr +0 -0
  223. package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.xdot +55 -0
  224. package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.dot +34 -0
  225. package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.gv +13 -0
  226. package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.stderr +0 -0
  227. package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.xdot +55 -0
  228. package/src/layout/neato/__fixtures__/dim/hier-two-dim3.dot +15 -0
  229. package/src/layout/neato/__fixtures__/dim/hier-two-dim3.gv +6 -0
  230. package/src/layout/neato/__fixtures__/dim/hier-two-dim3.stderr +0 -0
  231. package/src/layout/neato/__fixtures__/dim/hier-two-dim3.xdot +22 -0
  232. package/src/layout/neato/__fixtures__/dim/ipsep-dim3.dot +33 -0
  233. package/src/layout/neato/__fixtures__/dim/ipsep-dim3.gv +12 -0
  234. package/src/layout/neato/__fixtures__/dim/ipsep-dim3.stderr +0 -0
  235. package/src/layout/neato/__fixtures__/dim/ipsep-dim3.xdot +54 -0
  236. package/src/layout/neato/__fixtures__/dim/kk-dim3.dot +33 -0
  237. package/src/layout/neato/__fixtures__/dim/kk-dim3.gv +12 -0
  238. package/src/layout/neato/__fixtures__/dim/kk-dim3.stderr +0 -0
  239. package/src/layout/neato/__fixtures__/dim/kk-dim3.xdot +54 -0
  240. package/src/layout/neato/__fixtures__/dim/kk-dim4-dimen4.dot +33 -0
  241. package/src/layout/neato/__fixtures__/dim/kk-dim4-dimen4.gv +12 -0
  242. package/src/layout/neato/__fixtures__/dim/kk-dim4-dimen4.stderr +0 -0
  243. package/src/layout/neato/__fixtures__/dim/kk-dim4-dimen4.xdot +54 -0
  244. package/src/layout/neato/__fixtures__/dim/kk-pins-dim3.dot +39 -0
  245. package/src/layout/neato/__fixtures__/dim/kk-pins-dim3.gv +15 -0
  246. package/src/layout/neato/__fixtures__/dim/kk-pins-dim3.stderr +0 -0
  247. package/src/layout/neato/__fixtures__/dim/kk-pins-dim3.xdot +60 -0
  248. package/src/layout/neato/__fixtures__/dim/overlap-false-dim3.dot +33 -0
  249. package/src/layout/neato/__fixtures__/dim/overlap-false-dim3.gv +12 -0
  250. package/src/layout/neato/__fixtures__/dim/overlap-false-dim3.stderr +0 -0
  251. package/src/layout/neato/__fixtures__/dim/overlap-false-dim3.xdot +54 -0
  252. package/src/layout/neato/__fixtures__/dim/overlap-scale-dim3.dot +33 -0
  253. package/src/layout/neato/__fixtures__/dim/overlap-scale-dim3.gv +12 -0
  254. package/src/layout/neato/__fixtures__/dim/overlap-scale-dim3.stderr +0 -0
  255. package/src/layout/neato/__fixtures__/dim/overlap-scale-dim3.xdot +54 -0
  256. package/src/layout/neato/__fixtures__/dim/overlap-vpsc-dim3.dot +33 -0
  257. package/src/layout/neato/__fixtures__/dim/overlap-vpsc-dim3.gv +12 -0
  258. package/src/layout/neato/__fixtures__/dim/overlap-vpsc-dim3.stderr +0 -0
  259. package/src/layout/neato/__fixtures__/dim/overlap-vpsc-dim3.xdot +54 -0
  260. package/src/layout/neato/__fixtures__/dim/pack-dim3.dot +47 -0
  261. package/src/layout/neato/__fixtures__/dim/pack-dim3.gv +14 -0
  262. package/src/layout/neato/__fixtures__/dim/pack-dim3.stderr +0 -0
  263. package/src/layout/neato/__fixtures__/dim/pack-dim3.xdot +78 -0
  264. package/src/layout/neato/__fixtures__/dim/pins-dim3.dot +38 -0
  265. package/src/layout/neato/__fixtures__/dim/pins-dim3.gv +14 -0
  266. package/src/layout/neato/__fixtures__/dim/pins-dim3.stderr +0 -0
  267. package/src/layout/neato/__fixtures__/dim/pins-dim3.xdot +59 -0
  268. package/src/layout/neato/__fixtures__/dim/regen.sh +24 -0
  269. package/src/layout/neato/__fixtures__/dim/regular-dim3.dot +33 -0
  270. package/src/layout/neato/__fixtures__/dim/regular-dim3.gv +12 -0
  271. package/src/layout/neato/__fixtures__/dim/regular-dim3.stderr +0 -0
  272. package/src/layout/neato/__fixtures__/dim/regular-dim3.xdot +54 -0
  273. package/src/layout/neato/__fixtures__/dim/sgd-dim3.dot +33 -0
  274. package/src/layout/neato/__fixtures__/dim/sgd-dim3.gv +12 -0
  275. package/src/layout/neato/__fixtures__/dim/sgd-dim3.stderr +0 -0
  276. package/src/layout/neato/__fixtures__/dim/sgd-dim3.xdot +54 -0
  277. package/src/layout/neato/__fixtures__/dim/smart-units.json +16 -0
  278. package/src/layout/neato/__fixtures__/dim/subset-dim3.dot +33 -0
  279. package/src/layout/neato/__fixtures__/dim/subset-dim3.gv +12 -0
  280. package/src/layout/neato/__fixtures__/dim/subset-dim3.stderr +0 -0
  281. package/src/layout/neato/__fixtures__/dim/subset-dim3.xdot +54 -0
  282. package/src/layout/neato/closest.ts +206 -0
  283. package/src/layout/neato/constrained-majorization.ts +4 -23
  284. package/src/layout/neato/embed-graph.ts +81 -0
  285. package/src/layout/neato/fdp-adjust.ts +22 -8
  286. package/src/layout/neato/index.ts +26 -17
  287. package/src/layout/neato/init-dim.ts +165 -0
  288. package/src/layout/neato/init.ts +9 -35
  289. package/src/layout/neato/kk.ts +47 -41
  290. package/src/layout/neato/matrix-ops-dense.ts +232 -0
  291. package/src/layout/neato/pca.ts +60 -0
  292. package/src/layout/neato/sgd.ts +14 -13
  293. package/src/layout/neato/start.ts +8 -5
  294. package/src/layout/neato/stress-kernel.ts +65 -5
  295. package/src/layout/neato/stress-subspace.ts +371 -0
  296. package/src/layout/neato/vpsc-adjust.ts +3 -1
  297. package/src/layout/pack/__fixtures__/cc-reuse/circo.dot +23 -0
  298. package/src/layout/pack/__fixtures__/cc-reuse/circo.gv +1 -0
  299. package/src/layout/pack/__fixtures__/cc-reuse/circo.stderr +0 -0
  300. package/src/layout/pack/__fixtures__/cc-reuse/circo.xdot +38 -0
  301. package/src/layout/pack/__fixtures__/cc-reuse/neato.dot +23 -0
  302. package/src/layout/pack/__fixtures__/cc-reuse/neato.gv +1 -0
  303. package/src/layout/pack/__fixtures__/cc-reuse/neato.stderr +0 -0
  304. package/src/layout/pack/__fixtures__/cc-reuse/neato.xdot +38 -0
  305. package/src/layout/pack/__fixtures__/cc-reuse/osage.dot +23 -0
  306. package/src/layout/pack/__fixtures__/cc-reuse/osage.gv +1 -0
  307. package/src/layout/pack/__fixtures__/cc-reuse/osage.stderr +0 -0
  308. package/src/layout/pack/__fixtures__/cc-reuse/osage.xdot +38 -0
  309. package/src/layout/pack/__fixtures__/cc-reuse/regen.sh +24 -0
  310. package/src/layout/pack/__fixtures__/cc-reuse/sfdp.dot +21 -0
  311. package/src/layout/pack/__fixtures__/cc-reuse/sfdp.gv +1 -0
  312. package/src/layout/pack/__fixtures__/cc-reuse/sfdp.stderr +0 -0
  313. package/src/layout/pack/__fixtures__/cc-reuse/sfdp.xdot +36 -0
  314. package/src/layout/pack/__fixtures__/cc-reuse/twopi.dot +21 -0
  315. package/src/layout/pack/__fixtures__/cc-reuse/twopi.gv +1 -0
  316. package/src/layout/pack/__fixtures__/cc-reuse/twopi.stderr +1 -0
  317. package/src/layout/pack/__fixtures__/cc-reuse/twopi.xdot +36 -0
  318. package/src/layout/pack/ccomps.ts +34 -6
  319. package/src/layout/sfdp/__fixtures__/dim/dim3-dimen3.dot +32 -0
  320. package/src/layout/sfdp/__fixtures__/dim/dim3-dimen3.gv +11 -0
  321. package/src/layout/sfdp/__fixtures__/dim/dim3-dimen3.stderr +0 -0
  322. package/src/layout/sfdp/__fixtures__/dim/dim3-dimen3.xdot +53 -0
  323. package/src/layout/sfdp/__fixtures__/dim/dim3.dot +31 -0
  324. package/src/layout/sfdp/__fixtures__/dim/dim3.gv +10 -0
  325. package/src/layout/sfdp/__fixtures__/dim/dim3.stderr +0 -0
  326. package/src/layout/sfdp/__fixtures__/dim/dim3.xdot +52 -0
  327. package/src/layout/sfdp/__fixtures__/dim/dim4-dimen4.dot +32 -0
  328. package/src/layout/sfdp/__fixtures__/dim/dim4-dimen4.gv +11 -0
  329. package/src/layout/sfdp/__fixtures__/dim/dim4-dimen4.stderr +0 -0
  330. package/src/layout/sfdp/__fixtures__/dim/dim4-dimen4.xdot +53 -0
  331. package/src/layout/sfdp/__fixtures__/dim/overlap-prism-dim3.dot +33 -0
  332. package/src/layout/sfdp/__fixtures__/dim/overlap-prism-dim3.gv +12 -0
  333. package/src/layout/sfdp/__fixtures__/dim/overlap-prism-dim3.stderr +0 -0
  334. package/src/layout/sfdp/__fixtures__/dim/overlap-prism-dim3.xdot +54 -0
  335. package/src/layout/sfdp/__fixtures__/dim/regen.sh +24 -0
  336. package/src/layout/sfdp/index.ts +15 -10
  337. package/src/layout/sfdp/init.ts +26 -11
  338. package/src/layout/twopi/circle.ts +5 -1
  339. package/src/layout/twopi/index.ts +3 -0
  340. package/src/render/dot/agwrite.ts +2 -2
  341. package/src/render/dot/attrs.ts +16 -0
  342. package/src/render/dot/write-back.ts +2 -2
@@ -0,0 +1,54 @@
1
+ graph G {
2
+ graph [_draw_="c 9 -#fffffe00 C 7 -#ffffff P 4 0 0 0 290.05 248.74 290.05 248.74 0 ",
3
+ bb="0,0,248.74,290.05",
4
+ dim=3,
5
+ dimen=3,
6
+ overlap=prism,
7
+ xdotversion=1.7
8
+ ];
9
+ node [label="\N"];
10
+ a [_draw_="c 7 -#000000 e 81.11 195.63 27 18 ",
11
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 81.11 191.43 0 6.21 1 -a ",
12
+ height=0.5,
13
+ pos="81.115,195.63,-712.58",
14
+ width=0.75];
15
+ b [_draw_="c 7 -#000000 e 27 272.05 27 18 ",
16
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 27 267.85 0 7 1 -b ",
17
+ height=0.5,
18
+ pos="27,272.05,-746.78",
19
+ width=0.75];
20
+ a -- b [_draw_="c 7 -#000000 B 4 69.37 212.21 60.3 225.03 47.79 242.69 38.72 255.5 ",
21
+ pos="69.373,212.21 60.296,225.03 47.79,242.69 38.719,255.5"];
22
+ c [_draw_="c 7 -#000000 e 85.4 226.11 27 18 ",
23
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 85.4 221.91 0 6.21 1 -c ",
24
+ height=0.5,
25
+ pos="85.401,226.11,-801.24",
26
+ width=0.75];
27
+ a -- c [_draw_="c 7 -#000000 B 4 83.66 213.71 83.67 213.82 83.69 213.92 83.7 214.02 ",
28
+ pos="83.658,213.71 83.672,213.82 83.686,213.92 83.701,214.02"];
29
+ b -- c [_draw_="c 7 -#000000 B 4 44.84 258.01 52.09 252.31 60.44 245.75 67.67 240.06 ",
30
+ pos="44.84,258.01 52.085,252.31 60.436,245.75 67.671,240.06"];
31
+ d [_draw_="c 7 -#000000 e 156.36 144.76 27 18 ",
32
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 156.36 140.56 0 7 1 -d ",
33
+ height=0.5,
34
+ pos="156.36,144.76,-803.5",
35
+ width=0.75];
36
+ c -- d [_draw_="c 7 -#000000 B 4 99.08 210.42 111.57 196.11 129.93 175.06 142.47 160.67 ",
37
+ pos="99.082,210.42 111.57,196.11 129.93,175.06 142.47,160.67"];
38
+ e [_draw_="c 7 -#000000 e 160.26 102.33 27 18 ",
39
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 160.26 98.13 0 6.21 1 -e ",
40
+ height=0.5,
41
+ pos="160.26,102.33,-708.71",
42
+ width=0.75];
43
+ d -- e [_draw_="c 7 -#000000 B 4 158.03 126.52 158.22 124.54 158.4 122.53 158.58 120.55 ",
44
+ pos="158.03,126.52 158.22,124.54 158.4,122.53 158.58,120.55"];
45
+ e -- a [_draw_="c 7 -#000000 B 4 146.83 118.16 132.28 135.32 109.19 162.54 94.61 179.73 ",
46
+ pos="146.83,118.16 132.28,135.32 109.19,162.54 94.606,179.73"];
47
+ f [_draw_="c 7 -#000000 e 221.74 18 27 18 ",
48
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 221.74 13.8 0 4.66 1 -f ",
49
+ height=0.5,
50
+ pos="221.74,18,-676.03",
51
+ width=0.75];
52
+ e -- f [_draw_="c 7 -#000000 B 4 172.11 86.07 182.93 71.23 198.84 49.41 209.72 34.5 ",
53
+ pos="172.11,86.072 182.93,71.234 198.84,49.409 209.72,34.498"];
54
+ }
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env bash
2
+ # SPDX-License-Identifier: EPL-2.0
3
+ # Regenerates these part-10 fixtures: graphviz 16.1.0 (oracle/16.1.0). One <case>.xdot,
4
+ # <case>.dot and <case>.stderr per <case>.gv. Engine sfdp. The .stderr is the -Txdot run's;
5
+ # regen reports a case whose -Tdot stderr differs. Inputs come from
6
+ # plans/post-16-1-followups-10/harness/T0/gen-fixtures.py.
7
+ #
8
+ # Usage: GVBINDIR=<full plugin dir> bash regen.sh
9
+ set -u
10
+ DOT=${DOT:-$HOME/git/graphviz/build/cmd/dot/dot}
11
+ cd "$(dirname "$0")"
12
+ for f in *.gv; do
13
+ c=${f%.gv}
14
+ e=sfdp
15
+ "$DOT" -K"$e" -Txdot "$f" > "$c.xdot" 2> "$c.stderr"
16
+ rc=$?
17
+ [ "$rc" -eq 0 ] || echo "$c: xdot exit $rc"
18
+ err=$(mktemp)
19
+ "$DOT" -K"$e" -Tdot "$f" > "$c.dot" 2> "$err"
20
+ rc=$?
21
+ [ "$rc" -eq 0 ] || echo "$c: dot exit $rc"
22
+ cmp -s "$c.stderr" "$err" || echo "$c: dot stderr differs"
23
+ rm -f "$err"
24
+ done
@@ -13,10 +13,12 @@
13
13
 
14
14
  import type { Graph } from '../../model/graph.js';
15
15
  import type { LayoutEngine } from '../../gvc/context.js';
16
+ import { agdelsubg } from '../../model/cgraph-ops.js';
16
17
  import { csrand } from '../../common/crand.js';
17
18
  import { graphInit } from '../../common/graph-init.js';
18
19
  import { setEdgeTypeFromAttr } from '../dot/index.js';
19
20
  import { EDGETYPE_LINE, splineEdgesShifted } from '../neato/splines.js';
21
+ import { ndimOf } from '../neato/init-dim.js';
20
22
  import { sepFactor, DFLT_MARGIN } from '../neato/sep-factor.js';
21
23
  import {
22
24
  ccomps,
@@ -50,9 +52,6 @@ import {
50
52
  export { sfdpInitGraph, sfdpCleanup, tuneControl, makeMatrix, getSizes, getPos };
51
53
  export { multilevelSpringElectricalEmbedding };
52
54
 
53
- /** GD_ndim is fixed at 2 — see sfdpInitGraph. */
54
- const DIM = 2;
55
-
56
55
  /**
57
56
  * Lay out one connected graph: adjacency matrix, label half-sizes,
58
57
  * starting positions, the multilevel embedding, ND_pos write-back.
@@ -61,16 +60,17 @@ const DIM = 2;
61
60
  export function sfdpLayoutComponent(
62
61
  g: Graph, ctrl: SpringElectricalControl, pad: { x: number; y: number },
63
62
  ): void {
63
+ const ndim = ndimOf(g);
64
64
  const A = makeMatrix(g);
65
65
  // edge_labeling_scheme > 0 (|edgelabel| nodes) is not ported.
66
- const sizes = ctrl.overlap >= 0 ? getSizes(g, pad) : null;
67
- const pos = getPos(g, DIM);
66
+ const sizes = ctrl.overlap >= 0 ? getSizes(g, pad, ndim) : null;
67
+ const pos = getPos(g, ndim);
68
68
 
69
- multilevelSpringElectricalEmbedding(DIM, A, ctrl, sizes, pos);
69
+ multilevelSpringElectricalEmbedding(ndim, A, ctrl, sizes, pos);
70
70
 
71
71
  for (const n of g.nodes.values()) {
72
72
  const i = n.info.id!;
73
- n.info.pos = [pos[i * DIM]!, pos[i * DIM + 1]!];
73
+ n.info.pos = pos.slice(i * ndim, (i + 1) * ndim);
74
74
  }
75
75
  }
76
76
 
@@ -100,7 +100,10 @@ function resolveControl(g: Graph): {
100
100
  const flag = overlap === undefined ? 'prism0' : overlap;
101
101
  warnUnrecognizedOverlap(flag); // graphAdjustMode → getAdjustMode, once per layout
102
102
  const ntry = overlapPrismTries(flag);
103
- if (ntry !== null) {
103
+ // C: `int doAdjust = Ndim == 2;` — in 3 or more dimensions no overlap is
104
+ // removed at all (ctrl.overlap = -1 and no removeOverlapWith).
105
+ const doAdjust = ndimOf(g) === 2;
106
+ if (ntry !== null && doAdjust) {
104
107
  // AM_PRISM && doAdjust: overlap removal happens inside sfdp.
105
108
  ctrl.overlap = ntry;
106
109
  ctrl.initialScaling = lateDouble(
@@ -112,9 +115,10 @@ function resolveControl(g: Graph): {
112
115
  }
113
116
  return { ctrl, pad, doAdjust: false };
114
117
  }
115
- // Non-PRISM: turn off in-sfdp removal; run removeOverlapWith after layout.
118
+ // Non-PRISM (or Ndim != 2): turn off in-sfdp removal; run removeOverlapWith
119
+ // after layout only when doAdjust.
116
120
  ctrl.overlap = -1;
117
- return { ctrl, pad, doAdjust: true };
121
+ return { ctrl, pad, doAdjust };
118
122
  }
119
123
 
120
124
  /**
@@ -218,6 +222,7 @@ export function sfdpLayout(g: Graph): void {
218
222
  } else {
219
223
  layoutComponents(g, comps, ctrl, pad, doAdjust);
220
224
  }
225
+ for (const c of comps) agdelsubg(g, c); // @see lib/sfdpgen/sfdpinit.c:289
221
226
  }
222
227
 
223
228
  postprocess(g, singleComponent);
@@ -15,6 +15,7 @@ import type { Graph } from '../../model/graph.js';
15
15
  import { setEdgeTypeFromAttr } from '../dot/index.js';
16
16
  import { EDGETYPE_LINE } from '../neato/splines.js';
17
17
  import { neatoInitNode } from '../neato/init.js';
18
+ import { DFLT_DIM, MAXDIM } from '../neato/init-dim.js';
18
19
  import {
19
20
  commonInitNodeEdge, lateDouble, lateInt, layoutMeasurer,
20
21
  } from '../../common/nodeinit.js';
@@ -47,9 +48,22 @@ const ELSCHEME_PENALTY2 = 2;
47
48
  const EDGE_LABEL_NODE_PREFIX = '|edgelabel|';
48
49
 
49
50
  /**
50
- * Graph-level init: line edges, 2-D, per-node neato init.
51
- * GD_ndim handling is fixed at 2 — the "dim"/"dimen" 3D+ modes are not
52
- * ported (no supported input sets them).
51
+ * Read `dimen`, then `dim`, clamp at MAXDIM, into the root's `ndim` and `odim`
52
+ * (C's GD_ndim, GD_odim and the global Ndim).
53
+ * @see lib/sfdpgen/sfdpinit.c:sfdp_init_graph
54
+ */
55
+ function sfdpInitDim(g: Graph): number {
56
+ const root = g.root;
57
+ const outdim = lateInt(aggetGraph(g, 'dimen'), DFLT_DIM, 2);
58
+ const ndim = Math.min(lateInt(aggetGraph(g, 'dim'), outdim, 2), MAXDIM);
59
+ root.info.ndim = ndim;
60
+ root.info.odim = Math.min(outdim, ndim);
61
+ return ndim;
62
+ }
63
+
64
+ /**
65
+ * Graph-level init: line edges, the layout dimension from `dimen` and `dim`
66
+ * (root `ndim`, `odim`), per-node neato init sized to it.
53
67
  * @see lib/sfdpgen/sfdpinit.c:sfdp_init_graph
54
68
  * @see lib/sfdpgen/sfdpinit.c:sfdp_init_node_edge
55
69
  */
@@ -59,8 +73,9 @@ export function sfdpInitGraph(g: Graph): void {
59
73
  // setEdgeType FUNCTION (utils.c:1423): reads `splines`, LINE is the default.
60
74
  // @see lib/sfdpgen/sfdpinit.c:54
61
75
  setEdgeTypeFromAttr(g, EDGETYPE_LINE);
76
+ const ndim = sfdpInitDim(g);
62
77
  commonInitNodeEdge(g); // common_init_node inside neato_init_node
63
- for (const n of g.nodes.values()) neatoInitNode(n);
78
+ for (const n of g.nodes.values()) neatoInitNode(n, ndim);
64
79
  // C sfdp_init_node_edge runs a second loop over out-edges calling
65
80
  // sfdp_init_edge -> common_init_edge: it creates ED_label(e) and ORs
66
81
  // GD_has_labels with EDGE_LABEL, which is what lets addXLabels (in
@@ -228,17 +243,17 @@ export function makeMatrix(g: Graph): SpMatrix {
228
243
  }
229
244
 
230
245
  /**
231
- * Half node sizes plus padding, in inches, indexed by ND_id.
232
- * The |edgelabel| branch (edge_labeling_scheme > 0) is not ported —
233
- * no supported input sets label_scheme.
246
+ * Half node sizes plus padding, in inches, indexed by ND_id, `ndim` apart
247
+ * (x, y, then zeros). The |edgelabel| branch (edge_labeling_scheme > 0) is
248
+ * not ported — no supported input sets label_scheme.
234
249
  * @see lib/neatogen/adjust.c:getSizes (15.0.0)
235
250
  */
236
- export function getSizes(g: Graph, pad: { x: number; y: number }): number[] {
237
- const sizes = new Array<number>(2 * g.nodes.size).fill(0);
251
+ export function getSizes(g: Graph, pad: { x: number; y: number }, ndim: number = DFLT_DIM): number[] {
252
+ const sizes = new Array<number>(ndim * g.nodes.size).fill(0);
238
253
  for (const n of g.nodes.values()) {
239
254
  const i = n.info.id!;
240
- sizes[i * 2] = (n.info.width ?? 0) * 0.5 + pad.x;
241
- sizes[i * 2 + 1] = (n.info.height ?? 0) * 0.5 + pad.y;
255
+ sizes[i * ndim] = (n.info.width ?? 0) * 0.5 + pad.x;
256
+ sizes[i * ndim + 1] = (n.info.height ?? 0) * 0.5 + pad.y;
242
257
  }
243
258
  return sizes;
244
259
  }
@@ -8,6 +8,7 @@
8
8
  * @see lib/twopigen/circle.h
9
9
  */
10
10
 
11
+ import { agerrorf } from '../../common/agerr.js';
11
12
  import { InternalError } from '../../errors.js';
12
13
  import type { Graph } from '../../model/graph.js';
13
14
  import type { Node } from '../../model/node.js';
@@ -331,7 +332,10 @@ export function circleLayout(sg: Graph, center: Node | null): Node | null {
331
332
  if (center === null) center = findCenterNode(sg);
332
333
  if (center === null) return null;
333
334
  const maxN = setParentNodes(sg, center);
334
- if (maxN === Number.MAX_SAFE_INTEGER) return center;
335
+ if (maxN === Number.MAX_SAFE_INTEGER) {
336
+ agerrorf('twopi: use of weight=0 creates disconnected component.');
337
+ return center;
338
+ }
335
339
  setSubtreeSize(sg);
336
340
  setSubtreeSpans(sg, center);
337
341
  setPositions(sg, center);
@@ -9,6 +9,7 @@
9
9
  import type { Graph } from '../../model/graph.js';
10
10
  import type { LayoutEngine } from '../../gvc/context.js';
11
11
  import { twopiInitGraph, twopiCleanup } from './init.js';
12
+ import { agdelsubg } from '../../model/cgraph-ops.js';
12
13
  import { ccomps, normalizeGraphBB } from '../pack/index.js';
13
14
  import { layoutSingle, layoutMulti, buildPackInfo } from './pipeline.js';
14
15
  import { commonInitNodeEdge, layoutMeasurer } from '../../common/nodeinit.js';
@@ -58,6 +59,8 @@ export function twopiLayout(g: Graph): void {
58
59
  } else {
59
60
  layoutMulti(g, comps, globalRoot, buildPackInfo(g));
60
61
  }
62
+ // @see lib/twopigen/twopiinit.c:twopi_layout (agdelete of each component)
63
+ for (const c of comps) agdelsubg(g, c);
61
64
  normalizeGraphBB(g);
62
65
  // C: dotneato_postprocess(g) — cluster labels, edge labels (addXLabels), root
63
66
  // graph label space + translate. @see lib/twopigen/twopiinit.c:152
@@ -25,7 +25,7 @@ import {
25
25
  COMPUTED_EDGE_ATTRS, COMPUTED_NODE_ATTRS, appendRecordRects, computedPart, dictParts,
26
26
  echoAttr, echoGraphAttr, edgeAttrsAttached, edgeConnector, edgePosRaw,
27
27
  effectiveEdgeDefaults, effectiveNodeDefaults, graphInputParts, graphLabelAttrs,
28
- isDirected, nodeDictParts, nodeRecord, objInputParts,
28
+ isDirected, nodeDictParts, nodePosRaw, nodeRecord, objInputParts,
29
29
  } from './attrs.js';
30
30
  import { nodesInSeq } from '../../layout/dot/decomp.js';
31
31
  import type { XdotDraws, SerCtx } from './types.js';
@@ -390,7 +390,7 @@ export abstract class DotWriterBase {
390
390
  // engine leaves them divergent — patchwork's finishNode lets poly_init
391
391
  // clobber ND_width/height while the tile survives in lw/rw/ht.
392
392
  const defs = effectiveNodeDefaults(scope);
393
- const posRaw = gfmt5(info.coord.x) + ',' + gfmt5(info.coord.y);
393
+ const posRaw = nodePosRaw(n);
394
394
  const widthRaw = gfmt5((info.lw + info.rw) / 72);
395
395
  const heightRaw = gfmt5(info.ht / 72);
396
396
  const parts: string[] = [
@@ -29,6 +29,22 @@ export function edgeAttrsAttached(e: Edge): boolean {
29
29
  return e.info.edge_type !== IGNORED && e.info.spl != null;
30
30
  }
31
31
 
32
+ /**
33
+ * A node's `pos` value: x and y at `%.5g`, then, when the root's `odim` is 3 or
34
+ * more, `72 * ND_pos[k]` for k from 2 below `odim`. `plain` and the SVG family
35
+ * never reach this: they print two coordinates, as C.
36
+ * @see lib/common/output.c:attach_attrs_and_arrows
37
+ */
38
+ export function nodePosRaw(n: Node): string {
39
+ const c = n.info.coord;
40
+ let raw = gfmt5(c.x) + ',' + gfmt5(c.y);
41
+ const odim = n.root.info.odim ?? 2;
42
+ for (let k = 2; odim >= 3 && k < odim; k++) {
43
+ raw += ',' + gfmt5(POINTS_PER_INCH * (n.info.pos?.[k] ?? 0));
44
+ }
45
+ return raw;
46
+ }
47
+
32
48
  /**
33
49
  * Append the leaf-field rectangles of a record node, mirroring the recursion in
34
50
  * `set_record_rects`: a field with sub-fields contributes nothing itself, while
@@ -20,7 +20,7 @@ import type { Graph } from '../../model/graph.js';
20
20
  import type { Node } from '../../model/node.js';
21
21
  import { ownAttrs } from '../../model/lazy-attrs.js';
22
22
  import type { FieldT, ShapeDesc, TextlabelT } from '../../common/types.js';
23
- import { appendRecordRects, edgeAttrsAttached, edgePosRaw } from './attrs.js';
23
+ import { appendRecordRects, edgeAttrsAttached, edgePosRaw, nodePosRaw } from './attrs.js';
24
24
  import { gfmt2, gfmt5, lpStr, XDOT_VERSION } from './xdot-ops.js';
25
25
  import type { XdotDraws } from './types.js';
26
26
 
@@ -33,7 +33,7 @@ type DrawsOf = (obj: Node | Edge | Graph) => XdotDraws | undefined;
33
33
  function attachNode(n: Node): void {
34
34
  const attrs = ownAttrs(n);
35
35
  const info = n.info;
36
- attrs.set('pos', gfmt5(info.coord.x) + ',' + gfmt5(info.coord.y));
36
+ attrs.set('pos', nodePosRaw(n));
37
37
  attrs.set('height', gfmt5(info.ht / POINTS_PER_INCH));
38
38
  attrs.set('width', gfmt5((info.lw + info.rw) / POINTS_PER_INCH));
39
39
  const xlabel = info.xlabel as TextlabelT | undefined;