@knowvah/dot-engine 2.10.0 → 2.10.2

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 (392) hide show
  1. package/dist/gvc/context.d.ts +7 -1
  2. package/dist/gvc/context.d.ts.map +1 -1
  3. package/dist/gvc/device.d.ts +2 -3
  4. package/dist/gvc/device.d.ts.map +1 -1
  5. package/dist/gvc/emit-xdot.d.ts +11 -0
  6. package/dist/gvc/emit-xdot.d.ts.map +1 -0
  7. package/dist/gvc/init-xdot.d.ts +7 -0
  8. package/dist/gvc/init-xdot.d.ts.map +1 -0
  9. package/dist/gvc/landscape.d.ts +11 -0
  10. package/dist/gvc/landscape.d.ts.map +1 -0
  11. package/dist/gvc/layout-bb.d.ts +17 -0
  12. package/dist/gvc/layout-bb.d.ts.map +1 -0
  13. package/dist/gvc/layout-reset.d.ts +26 -0
  14. package/dist/gvc/layout-reset.d.ts.map +1 -0
  15. package/dist/gvc/usershape.d.ts +0 -2
  16. package/dist/gvc/usershape.d.ts.map +1 -1
  17. package/dist/gvc/viewport.d.ts +1 -10
  18. package/dist/gvc/viewport.d.ts.map +1 -1
  19. package/dist/index.js +1514 -768
  20. package/dist/index.js.map +4 -4
  21. package/dist/layout/circo/blocks.d.ts +2 -0
  22. package/dist/layout/circo/blocks.d.ts.map +1 -1
  23. package/dist/layout/circo/blocktree.d.ts +6 -0
  24. package/dist/layout/circo/blocktree.d.ts.map +1 -1
  25. package/dist/layout/circo/circular.d.ts +6 -0
  26. package/dist/layout/circo/circular.d.ts.map +1 -1
  27. package/dist/layout/dot/edge-route-rank.d.ts +34 -0
  28. package/dist/layout/dot/edge-route-rank.d.ts.map +1 -1
  29. package/dist/layout/dot/index.d.ts.map +1 -1
  30. package/dist/layout/dot/init.d.ts.map +1 -1
  31. package/dist/layout/dot/splines-flat-labeled.d.ts.map +1 -1
  32. package/dist/layout/dot/splines-flat-multi.d.ts.map +1 -1
  33. package/dist/layout/dot/splines-flat.d.ts +1 -2
  34. package/dist/layout/dot/splines-flat.d.ts.map +1 -1
  35. package/dist/layout/dot/splines.d.ts +2 -2
  36. package/dist/layout/dot/splines.d.ts.map +1 -1
  37. package/dist/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.d.ts +12 -0
  38. package/dist/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.d.ts.map +1 -0
  39. package/dist/layout/neato/dijkstra.d.ts +7 -0
  40. package/dist/layout/neato/dijkstra.d.ts.map +1 -1
  41. package/dist/layout/neato/splines.d.ts +7 -3
  42. package/dist/layout/neato/splines.d.ts.map +1 -1
  43. package/dist/layout/pack/ccomps.d.ts +32 -0
  44. package/dist/layout/pack/ccomps.d.ts.map +1 -0
  45. package/dist/layout/pack/index.d.ts +1 -24
  46. package/dist/layout/pack/index.d.ts.map +1 -1
  47. package/dist/layout/sfdp/init.d.ts.map +1 -1
  48. package/dist/render/dot/write-back.d.ts +37 -0
  49. package/dist/render/dot/write-back.d.ts.map +1 -0
  50. package/dist/render/dot.d.ts +5 -7
  51. package/dist/render/dot.d.ts.map +1 -1
  52. package/dist/render/json.d.ts +16 -21
  53. package/dist/render/json.d.ts.map +1 -1
  54. package/dist/render.js +1757 -1011
  55. package/dist/render.js.map +4 -4
  56. package/dist/util/libcxx-sort.d.ts +7 -0
  57. package/dist/util/libcxx-sort.d.ts.map +1 -0
  58. package/dist/vpsc/SweepLine.d.ts +2 -2
  59. package/dist/vpsc/SweepLine.d.ts.map +1 -1
  60. package/package.json +1 -1
  61. package/src/gvc/__fixtures__/replay-native.json +422 -0
  62. package/src/gvc/__fixtures__/rerender/background.dot.seq-xdot-svg.1 +25 -0
  63. package/src/gvc/__fixtures__/rerender/background.dot.seq-xdot-svg.2 +37 -0
  64. package/src/gvc/__fixtures__/rerender/background.gv +1 -0
  65. package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.plain.1 +5 -0
  66. package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.plain.2 +5 -0
  67. package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.xdot.1 +25 -0
  68. package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.xdot.2 +25 -0
  69. package/src/gvc/__fixtures__/rerender/cluster-lrvn.gv +1 -0
  70. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.plain.1 +7 -0
  71. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.plain.2 +7 -0
  72. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-dot-dot.1 +18 -0
  73. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-dot-dot.2 +18 -0
  74. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-plain-xdot.1 +7 -0
  75. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-plain-xdot.2 +33 -0
  76. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-dot.1 +33 -0
  77. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-dot.2 +33 -0
  78. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-plain.1 +33 -0
  79. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-plain.2 +7 -0
  80. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-svg.1 +33 -0
  81. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-svg.2 +46 -0
  82. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-then-svg.1 +33 -0
  83. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-then-svg.2 +47 -0
  84. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-xdot.1 +33 -0
  85. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-xdot.2 +33 -0
  86. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.xdot.1 +33 -0
  87. package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.xdot.2 +33 -0
  88. package/src/gvc/__fixtures__/rerender/cluster-skeleton.gv +1 -0
  89. package/src/gvc/__fixtures__/rerender/filing.circo.plain.1 +5 -0
  90. package/src/gvc/__fixtures__/rerender/filing.circo.plain.2 +5 -0
  91. package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.1 +5 -0
  92. package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.2 +5 -0
  93. package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.3 +5 -0
  94. package/src/gvc/__fixtures__/rerender/filing.circo.xdot.1 +20 -0
  95. package/src/gvc/__fixtures__/rerender/filing.circo.xdot.2 +20 -0
  96. package/src/gvc/__fixtures__/rerender/filing.dot.plain.1 +5 -0
  97. package/src/gvc/__fixtures__/rerender/filing.dot.plain.2 +5 -0
  98. package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.1 +5 -0
  99. package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.2 +5 -0
  100. package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.3 +5 -0
  101. package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-circo.2 +5 -0
  102. package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-fdp.2 +5 -0
  103. package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-neato.2 +5 -0
  104. package/src/gvc/__fixtures__/rerender/filing.dot.seq-dot-dot.1 +11 -0
  105. package/src/gvc/__fixtures__/rerender/filing.dot.seq-dot-dot.2 +11 -0
  106. package/src/gvc/__fixtures__/rerender/filing.dot.seq-json-json.1 +148 -0
  107. package/src/gvc/__fixtures__/rerender/filing.dot.seq-json-json.2 +162 -0
  108. package/src/gvc/__fixtures__/rerender/filing.dot.seq-plain-xdot.1 +5 -0
  109. package/src/gvc/__fixtures__/rerender/filing.dot.seq-plain-xdot.2 +20 -0
  110. package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-dot.1 +20 -0
  111. package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-dot.2 +20 -0
  112. package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-plain.1 +20 -0
  113. package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-plain.2 +5 -0
  114. package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-svg.1 +20 -0
  115. package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-svg.2 +30 -0
  116. package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-then-svg.1 +20 -0
  117. package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-then-svg.2 +31 -0
  118. package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-xdot.1 +20 -0
  119. package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-xdot.2 +20 -0
  120. package/src/gvc/__fixtures__/rerender/filing.dot.xdot.1 +20 -0
  121. package/src/gvc/__fixtures__/rerender/filing.dot.xdot.2 +20 -0
  122. package/src/gvc/__fixtures__/rerender/filing.fdp.plain.1 +5 -0
  123. package/src/gvc/__fixtures__/rerender/filing.fdp.plain.2 +5 -0
  124. package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.1 +5 -0
  125. package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.2 +5 -0
  126. package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.3 +5 -0
  127. package/src/gvc/__fixtures__/rerender/filing.fdp.xdot.1 +20 -0
  128. package/src/gvc/__fixtures__/rerender/filing.fdp.xdot.2 +21 -0
  129. package/src/gvc/__fixtures__/rerender/filing.gv +1 -0
  130. package/src/gvc/__fixtures__/rerender/filing.neato.plain.1 +5 -0
  131. package/src/gvc/__fixtures__/rerender/filing.neato.plain.2 +5 -0
  132. package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.1 +5 -0
  133. package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.2 +5 -0
  134. package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.3 +5 -0
  135. package/src/gvc/__fixtures__/rerender/filing.neato.seq-xdot-then-svg.1 +20 -0
  136. package/src/gvc/__fixtures__/rerender/filing.neato.seq-xdot-then-svg.2 +31 -0
  137. package/src/gvc/__fixtures__/rerender/filing.neato.xdot.1 +20 -0
  138. package/src/gvc/__fixtures__/rerender/filing.neato.xdot.2 +21 -0
  139. package/src/gvc/__fixtures__/rerender/filing.osage.plain.1 +5 -0
  140. package/src/gvc/__fixtures__/rerender/filing.osage.plain.2 +5 -0
  141. package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.1 +5 -0
  142. package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.2 +5 -0
  143. package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.3 +5 -0
  144. package/src/gvc/__fixtures__/rerender/filing.osage.xdot.1 +20 -0
  145. package/src/gvc/__fixtures__/rerender/filing.osage.xdot.2 +20 -0
  146. package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.1 +5 -0
  147. package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.2 +5 -0
  148. package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.1 +5 -0
  149. package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.2 +5 -0
  150. package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.3 +5 -0
  151. package/src/gvc/__fixtures__/rerender/filing.patchwork.xdot.1 +20 -0
  152. package/src/gvc/__fixtures__/rerender/filing.patchwork.xdot.2 +20 -0
  153. package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.1 +5 -0
  154. package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.2 +5 -0
  155. package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.1 +5 -0
  156. package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.2 +5 -0
  157. package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.3 +5 -0
  158. package/src/gvc/__fixtures__/rerender/filing.sfdp.xdot.1 +20 -0
  159. package/src/gvc/__fixtures__/rerender/filing.sfdp.xdot.2 +20 -0
  160. package/src/gvc/__fixtures__/rerender/filing.twopi.plain.1 +5 -0
  161. package/src/gvc/__fixtures__/rerender/filing.twopi.plain.2 +5 -0
  162. package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.1 +5 -0
  163. package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.2 +5 -0
  164. package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.3 +5 -0
  165. package/src/gvc/__fixtures__/rerender/filing.twopi.xdot.1 +20 -0
  166. package/src/gvc/__fixtures__/rerender/filing.twopi.xdot.2 +20 -0
  167. package/src/gvc/__fixtures__/rerender/mixed.circo.plain.1 +18 -0
  168. package/src/gvc/__fixtures__/rerender/mixed.circo.plain.2 +18 -0
  169. package/src/gvc/__fixtures__/rerender/mixed.circo.xdot.1 +103 -0
  170. package/src/gvc/__fixtures__/rerender/mixed.circo.xdot.2 +104 -0
  171. package/src/gvc/__fixtures__/rerender/mixed.dot.plain.1 +18 -0
  172. package/src/gvc/__fixtures__/rerender/mixed.dot.plain.2 +18 -0
  173. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-dot-dot.1 +75 -0
  174. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-dot-dot.2 +75 -0
  175. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-plain-xdot.1 +18 -0
  176. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-plain-xdot.2 +119 -0
  177. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-dot.1 +119 -0
  178. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-dot.2 +119 -0
  179. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-plain.1 +119 -0
  180. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-plain.2 +18 -0
  181. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-svg.1 +119 -0
  182. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-svg.2 +127 -0
  183. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-then-svg.1 +119 -0
  184. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-then-svg.2 +128 -0
  185. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-xdot.1 +119 -0
  186. package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-xdot.2 +119 -0
  187. package/src/gvc/__fixtures__/rerender/mixed.dot.xdot.1 +119 -0
  188. package/src/gvc/__fixtures__/rerender/mixed.dot.xdot.2 +119 -0
  189. package/src/gvc/__fixtures__/rerender/mixed.fdp.plain.1 +18 -0
  190. package/src/gvc/__fixtures__/rerender/mixed.fdp.xdot.1 +117 -0
  191. package/src/gvc/__fixtures__/rerender/mixed.gv +8 -0
  192. package/src/gvc/__fixtures__/rerender/mixed.neato.plain.1 +18 -0
  193. package/src/gvc/__fixtures__/rerender/mixed.neato.plain.2 +18 -0
  194. package/src/gvc/__fixtures__/rerender/mixed.neato.xdot.1 +117 -0
  195. package/src/gvc/__fixtures__/rerender/mixed.neato.xdot.2 +118 -0
  196. package/src/gvc/__fixtures__/rerender/mixed.osage.plain.1 +18 -0
  197. package/src/gvc/__fixtures__/rerender/mixed.osage.plain.2 +18 -0
  198. package/src/gvc/__fixtures__/rerender/mixed.osage.xdot.1 +117 -0
  199. package/src/gvc/__fixtures__/rerender/mixed.osage.xdot.2 +117 -0
  200. package/src/gvc/__fixtures__/rerender/mixed.patchwork.plain.1 +18 -0
  201. package/src/gvc/__fixtures__/rerender/mixed.patchwork.plain.2 +18 -0
  202. package/src/gvc/__fixtures__/rerender/mixed.patchwork.xdot.1 +78 -0
  203. package/src/gvc/__fixtures__/rerender/mixed.patchwork.xdot.2 +79 -0
  204. package/src/gvc/__fixtures__/rerender/mixed.sfdp.plain.1 +18 -0
  205. package/src/gvc/__fixtures__/rerender/mixed.sfdp.xdot.1 +103 -0
  206. package/src/gvc/__fixtures__/rerender/mixed.twopi.plain.1 +18 -0
  207. package/src/gvc/__fixtures__/rerender/mixed.twopi.plain.2 +18 -0
  208. package/src/gvc/__fixtures__/rerender/mixed.twopi.xdot.1 +103 -0
  209. package/src/gvc/__fixtures__/rerender/mixed.twopi.xdot.2 +103 -0
  210. package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.1 +29 -0
  211. package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.2 +29 -0
  212. package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.3 +29 -0
  213. package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.1 +29 -0
  214. package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.2 +29 -0
  215. package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.3 +29 -0
  216. package/src/gvc/__fixtures__/rerender/multi-edge.gv +16 -0
  217. package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.1 +29 -0
  218. package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.2 +29 -0
  219. package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.3 +29 -0
  220. package/src/gvc/__fixtures__/rerender/neato-pos.gv +1 -0
  221. package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-dot-plain.1 +34 -0
  222. package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-dot-plain.2 +18 -0
  223. package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json-plain.1 +471 -0
  224. package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json-plain.2 +18 -0
  225. package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json0-plain.1 +121 -0
  226. package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json0-plain.2 +18 -0
  227. package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-xdot-plain.1 +60 -0
  228. package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-xdot-plain.2 +18 -0
  229. package/src/gvc/__fixtures__/rerender/regen.sh +81 -0
  230. package/src/gvc/__fixtures__/rerender/sized-clip.gv +18 -0
  231. package/src/gvc/__fixtures__/rerender/sized-clip.neato.xdot.1 +86 -0
  232. package/src/gvc/__fixtures__/rerender/sized-clip.neato.xdot.2 +86 -0
  233. package/src/gvc/context.ts +13 -1
  234. package/src/gvc/device.ts +6 -6
  235. package/src/gvc/emit-xdot.ts +208 -0
  236. package/src/gvc/init-xdot.ts +36 -0
  237. package/src/gvc/landscape.ts +36 -0
  238. package/src/gvc/layout-bb.ts +43 -0
  239. package/src/gvc/layout-reset.ts +62 -0
  240. package/src/gvc/usershape.ts +0 -5
  241. package/src/gvc/viewport.ts +1 -32
  242. package/src/layout/circo/__fixtures__/root/both-connected.gv +11 -0
  243. package/src/layout/circo/__fixtures__/root/both-connected.xdot +53 -0
  244. package/src/layout/circo/__fixtures__/root/both-connected.xdot.stderr +0 -0
  245. package/src/layout/circo/__fixtures__/root/both-per-component.gv +18 -0
  246. package/src/layout/circo/__fixtures__/root/both-per-component.xdot +97 -0
  247. package/src/layout/circo/__fixtures__/root/both-per-component.xdot.stderr +0 -0
  248. package/src/layout/circo/__fixtures__/root/graph-none-node.gv +11 -0
  249. package/src/layout/circo/__fixtures__/root/graph-none-node.xdot +53 -0
  250. package/src/layout/circo/__fixtures__/root/graph-none-node.xdot.stderr +0 -0
  251. package/src/layout/circo/__fixtures__/root/graph-root-first.gv +17 -0
  252. package/src/layout/circo/__fixtures__/root/graph-root-first.xdot +96 -0
  253. package/src/layout/circo/__fixtures__/root/graph-root-first.xdot.stderr +0 -0
  254. package/src/layout/circo/__fixtures__/root/graph-root-later.gv +17 -0
  255. package/src/layout/circo/__fixtures__/root/graph-root-later.xdot +96 -0
  256. package/src/layout/circo/__fixtures__/root/graph-root-later.xdot.stderr +0 -0
  257. package/src/layout/circo/__fixtures__/root/graph-root-none.gv +17 -0
  258. package/src/layout/circo/__fixtures__/root/graph-root-none.xdot +96 -0
  259. package/src/layout/circo/__fixtures__/root/graph-root-none.xdot.stderr +0 -0
  260. package/src/layout/circo/__fixtures__/root/graph-root-paths.gv +7 -0
  261. package/src/layout/circo/__fixtures__/root/graph-root-paths.xdot +46 -0
  262. package/src/layout/circo/__fixtures__/root/graph-root-paths.xdot.stderr +0 -0
  263. package/src/layout/circo/__fixtures__/root/no-root-connected.gv +9 -0
  264. package/src/layout/circo/__fixtures__/root/no-root-connected.xdot +51 -0
  265. package/src/layout/circo/__fixtures__/root/no-root-connected.xdot.stderr +0 -0
  266. package/src/layout/circo/__fixtures__/root/no-root.gv +16 -0
  267. package/src/layout/circo/__fixtures__/root/no-root.xdot +95 -0
  268. package/src/layout/circo/__fixtures__/root/no-root.xdot.stderr +0 -0
  269. package/src/layout/circo/__fixtures__/root/node-root-connected.gv +10 -0
  270. package/src/layout/circo/__fixtures__/root/node-root-connected.xdot +52 -0
  271. package/src/layout/circo/__fixtures__/root/node-root-connected.xdot.stderr +0 -0
  272. package/src/layout/circo/__fixtures__/root/node-root-false.gv +10 -0
  273. package/src/layout/circo/__fixtures__/root/node-root-false.xdot +52 -0
  274. package/src/layout/circo/__fixtures__/root/node-root-false.xdot.stderr +0 -0
  275. package/src/layout/circo/__fixtures__/root/node-root-later.gv +17 -0
  276. package/src/layout/circo/__fixtures__/root/node-root-later.xdot +96 -0
  277. package/src/layout/circo/__fixtures__/root/node-root-later.xdot.stderr +0 -0
  278. package/src/layout/circo/__fixtures__/root/node-root-two.gv +11 -0
  279. package/src/layout/circo/__fixtures__/root/node-root-two.xdot +53 -0
  280. package/src/layout/circo/__fixtures__/root/node-root-two.xdot.stderr +0 -0
  281. package/src/layout/circo/__fixtures__/root/regen.sh +16 -0
  282. package/src/layout/circo/blocks.ts +3 -0
  283. package/src/layout/circo/blocktree.ts +17 -3
  284. package/src/layout/circo/circular.ts +13 -1
  285. package/src/layout/dot/edge-route-rank.ts +72 -0
  286. package/src/layout/dot/edge-route.ts +6 -6
  287. package/src/layout/dot/index.ts +2 -0
  288. package/src/layout/dot/init.ts +17 -5
  289. package/src/layout/dot/splines-flat-labeled.ts +2 -1
  290. package/src/layout/dot/splines-flat-multi.ts +2 -1
  291. package/src/layout/dot/splines-flat.ts +3 -3
  292. package/src/layout/dot/splines.ts +9 -9
  293. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.gv +17 -0
  294. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.xdot +115 -0
  295. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.xdot.stderr +0 -0
  296. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.gv +18 -0
  297. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.xdot +116 -0
  298. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.xdot.stderr +0 -0
  299. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.gv +18 -0
  300. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.xdot +116 -0
  301. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.xdot.stderr +0 -0
  302. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.gv +18 -0
  303. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.xdot +116 -0
  304. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.xdot.stderr +0 -0
  305. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.gv +18 -0
  306. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.xdot +116 -0
  307. package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.xdot.stderr +0 -0
  308. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.gv +18 -0
  309. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.xdot +102 -0
  310. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.xdot.stderr +0 -0
  311. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.gv +19 -0
  312. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.xdot +103 -0
  313. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.xdot.stderr +0 -0
  314. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.gv +19 -0
  315. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.xdot +103 -0
  316. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.xdot.stderr +3 -0
  317. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.gv +19 -0
  318. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.xdot +103 -0
  319. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.xdot.stderr +0 -0
  320. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.gv +19 -0
  321. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.xdot +103 -0
  322. package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.xdot.stderr +0 -0
  323. package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.gv +16 -0
  324. package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.xdot +100 -0
  325. package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.xdot.stderr +0 -0
  326. package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.gv +17 -0
  327. package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.xdot +101 -0
  328. package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.xdot.stderr +0 -0
  329. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.gv +18 -0
  330. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.xdot +106 -0
  331. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.xdot.stderr +0 -0
  332. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.gv +18 -0
  333. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.xdot +101 -0
  334. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.xdot.stderr +0 -0
  335. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.gv +17 -0
  336. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.xdot +101 -0
  337. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.xdot.stderr +0 -0
  338. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.gv +17 -0
  339. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.xdot +101 -0
  340. package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.xdot.stderr +0 -0
  341. package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.gv +17 -0
  342. package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.xdot +101 -0
  343. package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.xdot.stderr +0 -0
  344. package/src/layout/neato/__fixtures__/multi-component-attrs/regen.sh +16 -0
  345. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.gv +17 -0
  346. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.xdot +101 -0
  347. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.xdot.stderr +0 -0
  348. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.gv +18 -0
  349. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.xdot +102 -0
  350. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.xdot.stderr +0 -0
  351. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.gv +18 -0
  352. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.xdot +102 -0
  353. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.xdot.stderr +0 -0
  354. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.gv +18 -0
  355. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.xdot +102 -0
  356. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.xdot.stderr +0 -0
  357. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.gv +18 -0
  358. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.xdot +102 -0
  359. package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.xdot.stderr +0 -0
  360. package/src/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.ts +14 -0
  361. package/src/layout/neato/dijkstra.ts +12 -3
  362. package/src/layout/neato/splines.ts +18 -18
  363. package/src/layout/pack/ccomps.ts +131 -0
  364. package/src/layout/pack/index.ts +1 -95
  365. package/src/layout/sfdp/__fixtures__/start-warning/regen.sh +16 -0
  366. package/src/layout/sfdp/__fixtures__/start-warning/start-5.gv +15 -0
  367. package/src/layout/sfdp/__fixtures__/start-warning/start-5.xdot +77 -0
  368. package/src/layout/sfdp/__fixtures__/start-warning/start-5.xdot.stderr +0 -0
  369. package/src/layout/sfdp/__fixtures__/start-warning/start-random5.gv +15 -0
  370. package/src/layout/sfdp/__fixtures__/start-warning/start-random5.xdot +77 -0
  371. package/src/layout/sfdp/__fixtures__/start-warning/start-random5.xdot.stderr +0 -0
  372. package/src/layout/sfdp/__fixtures__/start-warning/start-regular.gv +15 -0
  373. package/src/layout/sfdp/__fixtures__/start-warning/start-regular.xdot +77 -0
  374. package/src/layout/sfdp/__fixtures__/start-warning/start-regular.xdot.stderr +1 -0
  375. package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.gv +16 -0
  376. package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.xdot +78 -0
  377. package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.xdot.stderr +2 -0
  378. package/src/layout/sfdp/__fixtures__/start-warning/start-self.gv +15 -0
  379. package/src/layout/sfdp/__fixtures__/start-warning/start-self.xdot +77 -0
  380. package/src/layout/sfdp/__fixtures__/start-warning/start-self.xdot.stderr +1 -0
  381. package/src/layout/sfdp/__fixtures__/start-warning/start-unset.gv +14 -0
  382. package/src/layout/sfdp/__fixtures__/start-warning/start-unset.xdot +76 -0
  383. package/src/layout/sfdp/__fixtures__/start-warning/start-unset.xdot.stderr +0 -0
  384. package/src/layout/sfdp/index.ts +1 -1
  385. package/src/layout/sfdp/init.ts +9 -1
  386. package/src/layout/twopi/index.ts +1 -1
  387. package/src/render/dot/agwrite.ts +1 -1
  388. package/src/render/dot/write-back.ts +137 -0
  389. package/src/render/dot.ts +12 -12
  390. package/src/render/json.ts +34 -34
  391. package/src/util/libcxx-sort.ts +461 -0
  392. package/src/vpsc/SweepLine.ts +11 -12
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+ # SPDX-License-Identifier: EPL-2.0
3
+ # Regenerates these part-9 fixtures: graphviz 16.1.0 (oracle/16.1.0), -Kcirco -Txdot,
4
+ # one <case>.xdot and <case>.xdot.stderr per <case>.gv. Inputs come from
5
+ # plans/post-16-1-followups-9/harness/T0/gen-fixtures.py.
6
+ #
7
+ # Usage: GVBINDIR=<full plugin dir> bash regen.sh
8
+ set -u
9
+ DOT=${DOT:-$HOME/git/graphviz/build/cmd/dot/dot}
10
+ cd "$(dirname "$0")"
11
+ for f in *.gv; do
12
+ c=${f%.gv}
13
+ "$DOT" -Kcirco -Txdot "$f" > "$c.xdot" 2> "$c.xdot.stderr"
14
+ rc=$?
15
+ [ "$rc" -eq 0 ] || echo "$c: exit $rc"
16
+ done
@@ -194,6 +194,8 @@ export interface CircState {
194
194
  spanningTreeCount: number;
195
195
  minDist: number;
196
196
  rootname: string;
197
+ /** N_root: default of the declared node `root` attribute; null when undeclared. */
198
+ nRoot: string | null;
197
199
  }
198
200
 
199
201
  const MINDIST = 1.0;
@@ -208,6 +210,7 @@ export function makeCircState(blockCount: number): CircState {
208
210
  spanningTreeCount: 0,
209
211
  minDist: MINDIST,
210
212
  rootname: '',
213
+ nRoot: null,
211
214
  };
212
215
  }
213
216
 
@@ -9,6 +9,7 @@
9
9
  */
10
10
 
11
11
  import type { DerivedNode, DerivedEdge, DerivedGraph, SubGraph } from './blocks.js';
12
+ import { mapbool } from '../dot/rank.js';
12
13
  import { spanIncident } from './blockpath.js';
13
14
  import {
14
15
  type Block,
@@ -156,14 +157,27 @@ export function dfsVisit(ctx: DfsCtx, u: DerivedNode, isRoot: boolean): void {
156
157
  }
157
158
  }
158
159
 
160
+ /**
161
+ * Root of the block search: the component's node named `rootname`, else the
162
+ * first node whose `root` attribute is true, else the first node.
163
+ * @see lib/circogen/blocktree.c:find_blocks
164
+ */
165
+ export function findRoot(g: SubGraph, state: CircState): DerivedNode | null {
166
+ let root: DerivedNode | null = null;
167
+ if (state.rootname) root = g.nodes.find((dn) => dn.name === state.rootname) ?? null;
168
+ if (!root && state.nRoot !== null) {
169
+ root = g.nodes.find((dn) => mapbool(dn.orig.attrs.get('root') ?? state.nRoot ?? undefined)) ?? null;
170
+ }
171
+ if (!root && g.nodes.length > 0) root = g.nodes[0]!;
172
+ return root;
173
+ }
174
+
159
175
  export function findBlocks(
160
176
  g: SubGraph,
161
177
  state: CircState,
162
178
  allEdges: DerivedEdge[],
163
179
  ): void {
164
- let root: DerivedNode | null = null;
165
- if (state.rootname) root = g.parent.nodes.get(state.rootname) ?? null;
166
- if (!root && g.nodes.length > 0) root = g.nodes[0]!;
180
+ const root = findRoot(g, state);
167
181
  if (!root) return;
168
182
  const ord = new Map<DerivedNode, number>();
169
183
  g.nodes.forEach((dn, i) => ord.set(dn, i));
@@ -88,7 +88,7 @@ export function buildDerivedEdges(g: Graph, dg: DerivedGraph): DerivedEdge[] {
88
88
 
89
89
  /** Decompose derived graph into connected components with their edges. */
90
90
  export function derivedComponents(g: Graph, dg: DerivedGraph, allEdges: DerivedEdge[]): SubGraph[] {
91
- const comps = ccomps(g, '_cc');
91
+ const comps = ccomps(g);
92
92
  return comps.map((sg, i) => {
93
93
  const nodes: DerivedNode[] = [];
94
94
  for (const n of sg.nodes.values()) {
@@ -125,6 +125,17 @@ export function readMinDist(realg: Graph): number {
125
125
  return isNaN(v) || v < 0 ? 1.0 : v;
126
126
  }
127
127
 
128
+ /**
129
+ * N_root = agattr_text(rootg, AGNODE, "root", NULL): the declared default of
130
+ * the node `root` attribute, or null when no node declares it.
131
+ * @see lib/circogen/circular.c:initGraphAttrs
132
+ */
133
+ export function nodeRootDefault(realg: Graph): string | null {
134
+ const declared = realg.nodeDefaults.get('root');
135
+ if (declared !== undefined) return declared;
136
+ return Array.from(realg.nodes.values()).some((n) => n.attrs.has('root')) ? '' : null;
137
+ }
138
+
128
139
  /**
129
140
  * Lay out one connected component of the derived graph.
130
141
  * @see lib/circogen/circular.c:circularLayout
@@ -134,6 +145,7 @@ export function circularLayout(sg: SubGraph, realg: Graph, blockCount: number, a
134
145
  const state = makeCircState(blockCount);
135
146
  state.minDist = readMinDist(realg);
136
147
  state.rootname = realg.attrs.get('root') ?? '';
148
+ state.nRoot = nodeRootDefault(realg);
137
149
  let root: Block;
138
150
  if (isOneblock(realg)) root = createOneBlock(sg, state);
139
151
  else root = createBlocktree(sg, state, allEdges);
@@ -12,6 +12,8 @@
12
12
 
13
13
  import type { Graph } from '../../model/graph.js';
14
14
  import type { Node } from '../../model/node.js';
15
+ import type { Edge } from '../../model/edge.js';
16
+ import { swapBezier, swapEndsP } from './splines.js';
15
17
  import type { RankEdgeInfo } from './edge-route-routing.js';
16
18
 
17
19
  /** Minimum edge routing width. @see lib/dotgen/dotsplines.c:MINW */
@@ -108,6 +110,76 @@ export function resetSplineBounds(g: Graph): void {
108
110
  boundsSnapshotByGraph.delete(g);
109
111
  }
110
112
 
113
+ /**
114
+ * Per-edge count of the beziers a pass found already on the edge, which only a
115
+ * layout with no gvFreeLayout before it leaves there. An edge with no entry had
116
+ * no spline at the start of the pass. Rewritten by every `beginRoutingPass`.
117
+ */
118
+ const staleBeziersByEdge = new WeakMap<Edge, number>();
119
+
120
+ /**
121
+ * Start a `dotSplines_` pass on `g`: the bounds snapshot above, and the record of
122
+ * what an earlier layout left on each edge. C routes each edge once per
123
+ * `dot_splines_` and `new_spline` appends to whatever `ED_spl` holds, so stale
124
+ * beziers neither stop this pass routing an edge nor count as this pass's route.
125
+ * A stale `lost` is the same: this pass has not lost the edge yet.
126
+ * @see lib/dotgen/dotsplines.c:dot_splines_
127
+ * @see lib/common/splines.c:new_spline
128
+ */
129
+ export function beginRoutingPass(g: Graph): void {
130
+ resetSplineBounds(g);
131
+ for (const e of g.edges) {
132
+ e.info.lost = undefined;
133
+ if (e.info.spl === undefined) staleBeziersByEdge.delete(e);
134
+ else staleBeziersByEdge.set(e, e.info.spl.size);
135
+ }
136
+ }
137
+
138
+ /**
139
+ * True when this routing pass has installed a bezier on `e`. On a first layout no
140
+ * edge has a stale count, and this is exactly `e.info.spl !== undefined`.
141
+ */
142
+ export function routedThisPass(e: Edge): boolean {
143
+ const spl = e.info.spl;
144
+ if (spl === undefined) return false;
145
+ const stale = staleBeziersByEdge.get(e);
146
+ return stale === undefined || spl.size > stale;
147
+ }
148
+
149
+ /** The beziers `e` came into this routing pass holding, 0 on a first layout. */
150
+ export function staleBezierCount(e: Edge): number {
151
+ return staleBeziersByEdge.get(e) ?? 0;
152
+ }
153
+
154
+ /**
155
+ * True when `e` kept ED_adjacent from an earlier layout. C never clears the flag,
156
+ * so it routes `e` as adjacent even if a node now sits between its ends.
157
+ * @see lib/dotgen/flat.c:236
158
+ * @see lib/dotgen/dotsplines.c:366
159
+ */
160
+ export function staleAdjacent(e: Edge): boolean {
161
+ return staleBezierCount(e) > 0 && (e.info.adjacent ?? 0) !== 0;
162
+ }
163
+
164
+ /**
165
+ * Finish a pass's edge_normalize for the beziers an earlier layout left. C swaps
166
+ * the whole spline once, at the end of the pass, so a swapped edge's stale beziers
167
+ * end up reversed and after the new ones. The port's routers orient what they
168
+ * install as they go, and `swapSpline` leaves the stale beziers alone for this.
169
+ * @see lib/dotgen/dotsplines.c:edge_normalize
170
+ * @see lib/dotgen/dotsplines.c:swap_spline
171
+ */
172
+ export function swapStaleBeziers(g: Graph): void {
173
+ for (const e of g.edges) {
174
+ const stale = staleBezierCount(e);
175
+ const spl = e.info.spl;
176
+ if (stale === 0 || spl === undefined || !swapEndsP(e)) continue;
177
+ const old = spl.list.splice(0, stale).reverse();
178
+ for (const bz of old) swapBezier(bz);
179
+ spl.list.push(...old);
180
+ }
181
+ }
182
+
111
183
  /**
112
184
  * Extract RankEdgeInfo from the graph's rank table for an edge.
113
185
  * Returns undefined if rank geometry is not available.
@@ -25,7 +25,7 @@ import { clipAndInstall } from '../../common/splines-clip.js';
25
25
  import { normalizeVec } from './edge-route-geom.js';
26
26
  import { arrowDrawOpsForEnd } from './edge-route-arrow.js';
27
27
  import { linearBezier } from './edge-route-poly.js';
28
- import { rankEdgeInfoOf } from './edge-route-rank.js';
28
+ import { rankEdgeInfoOf, routedThisPass } from './edge-route-rank.js';
29
29
  import { routeRegularEdgeFaithful } from './edge-route-faithful.js';
30
30
  import { edgeRouteCmp } from './edge-order.js';
31
31
  import { isFlatAdjacent, makeFlatAdjEdges } from './splines-flat.js';
@@ -316,7 +316,7 @@ function isAdjacentPortFlat(e: GraphEdge, g: Graph): boolean {
316
316
  /** True when x is an unrouted adjacent same-rank flat edge (port or not): C
317
317
  * groups by main edge only, so a port-less sibling joins the aux call. */
318
318
  function isGroupableFlat(x: GraphEdge, g: Graph): boolean {
319
- return x.info.spl === undefined && x.tail.info.rank !== undefined
319
+ return !routedThisPass(x) && x.tail.info.rank !== undefined
320
320
  && x.tail.info.rank === x.head.info.rank && isFlatAdjacent(g, x);
321
321
  }
322
322
 
@@ -373,7 +373,7 @@ function routeFaithfulSidePort(e: GraphEdge, g: Graph): boolean {
373
373
  if (sameRank && isFlatAdjacent(g, e)) {
374
374
  const group = collectAdjacentFlatGroup(e, g);
375
375
  return makeFlatAdjEdges(g, group, group.length, edgeType(g)) === 0
376
- && e.info.spl !== undefined;
376
+ && routedThisPass(e);
377
377
  }
378
378
  // Non-adjacent flats: C groups identical-port siblings into ONE make_flat_edge
379
379
  // call and nests their splines (cnt-loop). Collect the group and route once;
@@ -382,7 +382,7 @@ function routeFaithfulSidePort(e: GraphEdge, g: Graph): boolean {
382
382
  // @see lib/dotgen/dotsplines.c:make_flat_edge, make_flat_bottom_edges
383
383
  if (sameRank) {
384
384
  const group = collectNonAdjacentFlatGroup(e, g);
385
- return routeFlatEdgeGroupFaithful(g, group, group.length, edgeType(g)) && e.info.spl !== undefined;
385
+ return routeFlatEdgeGroupFaithful(g, group, group.length, edgeType(g)) && routedThisPass(e);
386
386
  }
387
387
  const pts = routeRegularEdgeFaithful(g, e);
388
388
  if (pts === null) return false;
@@ -431,7 +431,7 @@ function routeFlatEdge(e: GraphEdge, g: Graph): boolean {
431
431
  const group = collectNonAdjacentFlatGroup(e, g);
432
432
  if (group.length > 0
433
433
  && routeFlatEdgeGroupFaithful(g, group, group.length, edgeType(g))
434
- && e.info.spl !== undefined) return true;
434
+ && routedThisPass(e)) return true;
435
435
  }
436
436
  return false;
437
437
  }
@@ -486,7 +486,7 @@ function orderedDotEdges(g: Graph): GraphEdge[] {
486
486
  export function routeLoneEdge(e: GraphEdge, g: Graph): void {
487
487
  // A lost edge (routesplines failure, C semantics) is consumed: C routes each
488
488
  // edge exactly once, so the backstop sweep must not re-attempt it.
489
- if (e.info.spl !== undefined || e.info.lost === true) return;
489
+ if (routedThisPass(e) || e.info.lost === true) return;
490
490
  // C dot_splines_ skips FLATORDER/IGNORED edges when building the route list;
491
491
  // an IGNORED edge (e.g. a concentrate-merged parallel duplicate) must get no
492
492
  // spline so emit draws only the representative. @see dotsplines.c:295
@@ -123,6 +123,8 @@ export function getAttrInt(g: Graph, key: string, defaultVal: number): number {
123
123
  * @see lib/dotgen/dotinit.c:dotLayout (static)
124
124
  */
125
125
  export function dotPhaseInit(g: Graph): void {
126
+ // C's dot_init_edge overwrites ED_weight; dotInitEdge keeps only an aux graph's stamp.
127
+ for (const e of g.edges) e.info.weight = undefined;
126
128
  dotGraphInit(g);
127
129
  setEdgeTypeFromAttr(g, EDGETYPE_SPLINE);
128
130
  setAspect(g);
@@ -223,6 +223,21 @@ export function dotInitSubg(g: Graph): void {
223
223
  // dotInitNodeEdge
224
224
  // ---------------------------------------------------------------------------
225
225
 
226
+ /**
227
+ * Drops a node's fast-graph lists. dot_init_node allocates new ones
228
+ * unconditionally, and dot_cleanup frees them, so neither a later layout nor a
229
+ * layout with no gvFreeLayout before it reads the previous layout's edges.
230
+ * @see lib/dotgen/dotinit.c:dot_init_node (alloc_elist)
231
+ * @see lib/dotgen/dotinit.c:dot_cleanup_node (free_list)
232
+ */
233
+ function clearFastGraphLists(n: Node): void {
234
+ n.info.in = undefined;
235
+ n.info.out = undefined;
236
+ n.info.flat_in = undefined;
237
+ n.info.flat_out = undefined;
238
+ n.info.other = undefined;
239
+ }
240
+
226
241
  /**
227
242
  * Calls commonInitNode (shape-aware, label-driven sizing) then
228
243
  * dotInitNode for every node, then dotInitEdge for every edge.
@@ -233,6 +248,7 @@ export function dotInitSubg(g: Graph): void {
233
248
  export function dotInitNodeEdge(g: Graph): void {
234
249
  for (const n of nodesInSeq(g)) {
235
250
  commonInitNode(n, g);
251
+ clearFastGraphLists(n); // C's alloc_elist does not keep the lists it replaces
236
252
  dotInitNode(n);
237
253
  }
238
254
  const measurer = g.root.info.gvc?.textMeasurer;
@@ -319,11 +335,7 @@ export function dotCleanup(g: Graph): void {
319
335
  let n: Node | undefined = g.info.nlist;
320
336
  while (n !== undefined) {
321
337
  const next: Node | undefined = n.info.next;
322
- n.info.in = undefined;
323
- n.info.out = undefined;
324
- n.info.flat_in = undefined;
325
- n.info.flat_out = undefined;
326
- n.info.other = undefined;
338
+ clearFastGraphLists(n);
327
339
  n.info.next = undefined;
328
340
  n.info.prev = undefined;
329
341
  n = next;
@@ -22,6 +22,7 @@ import { addBox } from '../../common/splines-path-shared.js';
22
22
  import { routeSplines, routePolylines } from '../../common/splines-routespl.js';
23
23
  import { clipAndInstall } from '../../common/splines-clip.js';
24
24
  import { buildDotSinfo } from './self-loop.js';
25
+ import { routedThisPass } from './edge-route-rank.js';
25
26
  import { TOP } from '../../common/splines-constants.js';
26
27
  import { edgeType, EDGETYPE_LINE, EDGETYPE_SPLINE, EDGETYPE_PLINE, getMainEdge, swapEndsP, swapEdgeSpline } from './splines.js';
27
28
  import { shortestPath, routeSpline, polyBarriers, makePolyline } from '../../pathplan/index.js';
@@ -401,7 +402,7 @@ export function makeAdjFlatNoPortEdge(g: Graph, e: Edge): boolean {
401
402
  // The group is rendered as a unit (both directions). When the opposing leg is
402
403
  // dispatched later it is already installed — skip re-rendering but report it
403
404
  // handled. C does the whole unordered group in one make_flat_adj_edges call.
404
- if (e.info.spl !== undefined) return true;
405
+ if (routedThisPass(e)) return true;
405
406
  const group = collectAdjFlatGroup(g, e);
406
407
  const et = edgeType(g);
407
408
  if (group.some(x => x.info.label !== undefined)) makeSimpleFlatLabels(group, et);
@@ -26,6 +26,7 @@ import { routeSplines, routePolylines } from '../../common/splines-routespl.js';
26
26
  import { clipAndInstall } from '../../common/splines-clip.js';
27
27
  import { graphRanksep } from './position-aux.js';
28
28
  import { buildDotSinfo } from './self-loop.js';
29
+ import { routedThisPass } from './edge-route-rank.js';
29
30
  import { EDGETYPE_LINE, EDGETYPE_SPLINE } from './splines.js';
30
31
  import { makeSimpleFlat } from './splines-flat-labeled.js';
31
32
  import {
@@ -74,7 +75,7 @@ function flatPortKey(e: Edge, lo: Node): { loP: Port; hiP: Port } {
74
75
  /** True when x is an unrouted non-adjacent same-rank flat edge (C make_flat_edge
75
76
  * routes EVERY non-adjacent flat; side ports are not a precondition). */
76
77
  function isNonAdjGroupable(x: Edge, g: Graph): boolean {
77
- return x.info.spl === undefined
78
+ return !routedThisPass(x)
78
79
  && x.tail.info.rank !== undefined
79
80
  && x.tail.info.rank === x.head.info.rank
80
81
  && !isFlatAdjacent(g, x);
@@ -30,7 +30,7 @@ import { TOP, BOTTOM, FLATEDGE } from '../../common/splines-constants.js';
30
30
  import {
31
31
  maximalBbox, appendRegularEnd, freshEndp, type BboxCtx,
32
32
  } from './edge-route-faithful.js';
33
- import { getSplineBounds } from './edge-route-rank.js';
33
+ import { getSplineBounds, staleAdjacent } from './edge-route-rank.js';
34
34
  import { graphRanksep } from './position-aux.js';
35
35
  import { Edge as EdgeClass } from '../../model/edge.js';
36
36
  import { cloneNode, cloneEdge, cleanupCloneGraph, transformf } from './splines-clone.js';
@@ -386,13 +386,13 @@ export function makeFlatAdjEdges(g: Graph, edges: Edge[], cnt: number, et: numbe
386
386
  }
387
387
 
388
388
  /**
389
- * True when a same-rank edge's endpoints are adjacent in rank order (no NORMAL
390
- * or labeled-virtual node between them) — the make_flat_adj_edges case.
389
+ * True when a same-rank edge's ends are adjacent in rank order (no NORMAL or labeled-virtual node between).
391
390
  * @see lib/dotgen/flat.c:checkFlatAdjacent
392
391
  */
393
392
  export function isFlatAdjacent(g: Graph, e: Edge): boolean {
394
393
  const r = e.tail.info.rank;
395
394
  if (r === undefined || e.head.info.rank !== r) return false;
395
+ if (staleAdjacent(e)) return true;
396
396
  const rank = g.info.rank?.[r];
397
397
  if (rank === undefined) return false;
398
398
  const to = e.tail.info.order ?? 0;
@@ -21,7 +21,7 @@ import { IGNORED, EDGE_LABEL } from './rank.js';
21
21
  import { markLowclusters } from './cluster.js';
22
22
  import { routeDotEdges } from './edge-route.js';
23
23
  import { collectOtherEdges } from './self-loop.js';
24
- import { resetSplineBounds } from './edge-route-rank.js';
24
+ import { beginRoutingPass, staleBezierCount, swapStaleBeziers } from './edge-route-rank.js';
25
25
  import { dispatchOrthoEdges } from './ortho-adapter.js';
26
26
  import { routeEdgeGroups } from './splines-groups.js';
27
27
  import { placePortLabels, placeRegularEdgeLabels, setEdgeLabelPos } from './splines-label.js';
@@ -298,10 +298,10 @@ export function swapBezier(b: Bezier): void {
298
298
  }
299
299
  }
300
300
 
301
- /** Reverse the list of beziers in a spline and swap each bezier. */
302
- export function swapSpline(s: Spline): void {
303
- s.list.reverse();
304
- for (const bz of s.list) swapBezier(bz);
301
+ /** Reverse the list of beziers in a spline after its first `stale`, and swap each of those. */
302
+ export function swapSpline(s: Spline, stale = 0): void {
303
+ s.list.push(...s.list.splice(stale).reverse());
304
+ for (let i = stale; i < s.list.length; i++) swapBezier(s.list[i]);
305
305
  }
306
306
 
307
307
  /**
@@ -317,7 +317,7 @@ export function swapSpline(s: Spline): void {
317
317
  */
318
318
  export function swapEdgeSpline(e: Edge): void {
319
319
  if (e.info.spl === undefined) return;
320
- swapSpline(e.info.spl);
320
+ swapSpline(e.info.spl, staleBezierCount(e));
321
321
  const t = e.info.tailArrowOps;
322
322
  e.info.tailArrowOps = e.info.headArrowOps;
323
323
  e.info.headArrowOps = t;
@@ -481,13 +481,13 @@ function curvedTop(g: Graph): void {
481
481
  }
482
482
 
483
483
  /**
484
- * Post-loop: vnode labels, normalize, routeDotEdges backstop (curved already
485
- * routed its groups; C skips routesplinesterm), port labels. @see c:422-471
484
+ * Post-loop: labels, normalize, backstop (curved skips it), port labels. @see c:422-471
486
485
  */
487
486
  function finalizeSplines(g: Graph, et: number, normalize: boolean): void {
488
487
  placeRegularEdgeLabels(g);
489
488
  if (normalize) edgeNormalize(g);
490
489
  if (et !== EDGETYPE_CURVED) routeDotEdges(g);
490
+ if (normalize) swapStaleBeziers(g);
491
491
  placePortLabels(g);
492
492
  setState(GVSPLINES); // @see dotsplines.c:477
493
493
  g.info.edgeLabelsDone = true; // @see dotsplines.c:471 (EdgeLabelsDone = 1)
@@ -504,7 +504,7 @@ export function dotSplines_(g: Graph, normalize: boolean): number {
504
504
  // Force the next getSplineBounds(g) access to recompute so this pass sees
505
505
  // a frozen snapshot immune to recoverSlack/resizeVn vnode mutations from
506
506
  // edges routed earlier in THIS SAME pass. @see edge-route-rank.ts:getSplineBounds
507
- resetSplineBounds(g);
507
+ beginRoutingPass(g);
508
508
  const edges: Edge[] = [];
509
509
  collectRankEdges(g, edges);
510
510
  // C sorts with libc qsort (LIST_SORT → gv_list_sort_ → qsort), which is
@@ -0,0 +1,17 @@
1
+ digraph G {
2
+ mode=hier;
3
+ a -> b;
4
+ b -> c;
5
+ c -> d;
6
+ d -> a;
7
+ a -> c;
8
+ e -> f;
9
+ f -> g;
10
+ g -> h;
11
+ h -> e;
12
+ e -> g;
13
+ h -> i;
14
+ j -> k;
15
+ k -> l;
16
+ l -> m;
17
+ }
@@ -0,0 +1,115 @@
1
+ digraph G {
2
+ graph [_draw_="c 9 -#fffffe00 C 7 -#ffffff P 4 0 0 0 456 355.34 456 355.34 0 ",
3
+ bb="0,0,355.34,456",
4
+ mode=hier,
5
+ xdotversion=1.7
6
+ ];
7
+ node [label="\N"];
8
+ a [_draw_="c 7 -#000000 e 254.32 80.11 27 18 ",
9
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 254.32 75.91 0 6.21 1 -a ",
10
+ height=0.5,
11
+ pos="254.32,80.11",
12
+ width=0.75];
13
+ b [_draw_="c 7 -#000000 e 328.34 80.11 27 18 ",
14
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 328.34 75.91 0 7 1 -b ",
15
+ height=0.5,
16
+ pos="328.34,80.11",
17
+ width=0.75];
18
+ a -> b [_draw_="c 7 -#000000 B 4 281.46 80.11 284.18 80.11 286.97 80.11 289.77 80.11 ",
19
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 289.69 83.61 299.69 80.11 289.69 76.61 ",
20
+ pos="e,301.2,80.11 281.46,80.11 284.18,80.11 286.97,80.11 289.77,80.11"];
21
+ c [_draw_="c 7 -#000000 e 287.87 18.39 27 18 ",
22
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 287.87 14.19 0 6.21 1 -c ",
23
+ height=0.5,
24
+ pos="287.87,18.39",
25
+ width=0.75];
26
+ a -> c [_draw_="c 7 -#000000 B 4 263.67 62.92 266.65 57.43 270.02 51.23 273.28 45.23 ",
27
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 276.15 47.28 277.85 36.82 270 43.93 ",
28
+ pos="e,278.57,35.49 263.67,62.917 266.65,57.433 270.02,51.228 273.28,45.228"];
29
+ b -> c [_draw_="c 7 -#000000 B 4 317.28 63.24 313.53 57.53 309.25 51 305.14 44.73 ",
30
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 308.15 42.94 299.74 36.5 302.3 46.78 ",
31
+ pos="e,298.91,35.235 317.28,63.245 313.53,57.529 309.25,51.002 305.14,44.729"];
32
+ d [_draw_="c 7 -#000000 e 214 18 27 18 ",
33
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 214 13.8 0 7 1 -d ",
34
+ height=0.5,
35
+ pos="214,18",
36
+ width=0.75];
37
+ c -> d [_draw_="c 7 -#000000 B 4 260.78 18.25 258.07 18.23 255.28 18.22 252.49 18.2 ",
38
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 252.61 14.7 242.6 18.15 252.58 21.7 ",
39
+ pos="e,241.08,18.143 260.78,18.247 258.07,18.232 255.28,18.218 252.49,18.203"];
40
+ d -> a [_draw_="c 7 -#000000 B 4 224.81 34.64 228.69 40.63 233.18 47.54 237.46 54.13 ",
41
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 234.28 55.67 242.66 62.15 240.15 51.86 ",
42
+ pos="e,243.49,63.42 224.81,34.644 228.69,40.632 233.18,47.537 237.46,54.129"];
43
+ e [_draw_="c 7 -#000000 e 131.89 151.06 27 18 ",
44
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 131.89 146.86 0 6.21 1 -e ",
45
+ height=0.5,
46
+ pos="131.89,151.06",
47
+ width=0.75];
48
+ f [_draw_="c 7 -#000000 e 206.43 151.06 27 18 ",
49
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 206.43 146.86 0 4.66 1 -f ",
50
+ height=0.5,
51
+ pos="206.43,151.06",
52
+ width=0.75];
53
+ e -> f [_draw_="c 7 -#000000 B 4 159.22 151.06 161.96 151.06 164.77 151.06 167.59 151.06 ",
54
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 167.59 154.56 177.59 151.06 167.59 147.56 ",
55
+ pos="e,179.1,151.06 159.22,151.06 161.96,151.06 164.77,151.06 167.59,151.06"];
56
+ g [_draw_="c 7 -#000000 e 164.87 89.54 27 18 ",
57
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 164.87 85.34 0 7 1 -g ",
58
+ height=0.5,
59
+ pos="164.87,89.541",
60
+ width=0.75];
61
+ e -> g [_draw_="c 7 -#000000 B 4 141.08 133.92 143.94 128.59 147.16 122.57 150.3 116.73 ",
62
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 153.38 118.39 155.02 107.92 147.21 115.08 ",
63
+ pos="e,155.73,106.59 141.08,133.92 143.94,128.59 147.16,122.57 150.3,116.73"];
64
+ f -> g [_draw_="c 7 -#000000 B 4 195.07 134.25 191.22 128.55 186.83 122.05 182.61 115.79 ",
65
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 185.56 113.91 177.06 107.58 179.76 117.83 ",
66
+ pos="e,176.21,106.33 195.07,134.25 191.22,128.55 186.83,122.05 182.61,115.79"];
67
+ h [_draw_="c 7 -#000000 e 90.33 89.17 27 18 ",
68
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 90.33 84.97 0 7 1 -h ",
69
+ height=0.5,
70
+ pos="90.327,89.168",
71
+ width=0.75];
72
+ g -> h [_draw_="c 7 -#000000 B 4 137.54 89.4 134.8 89.39 131.99 89.38 129.17 89.36 ",
73
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 129.19 85.86 119.17 89.31 129.15 92.86 ",
74
+ pos="e,117.66,89.305 137.54,89.404 134.8,89.39 131.99,89.376 129.17,89.362"];
75
+ h -> e [_draw_="c 7 -#000000 B 4 101.47 105.75 105.47 111.72 110.09 118.6 114.5 125.17 ",
76
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 111.4 126.82 119.88 133.17 117.21 122.92 ",
77
+ pos="e,120.72,134.43 101.47,105.75 105.47,111.72 110.09,118.6 114.5,125.17"];
78
+ i [_draw_="c 7 -#000000 e 27 52 27 18 ",
79
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 27 47.8 0 3.89 1 -i ",
80
+ height=0.5,
81
+ pos="27,52",
82
+ width=0.75];
83
+ h -> i [_draw_="c 7 -#000000 B 4 69.94 77.2 65.87 74.82 61.52 72.26 57.2 69.73 ",
84
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 59.05 66.75 48.65 64.71 55.51 72.79 ",
85
+ pos="e,47.347,63.942 69.941,77.203 65.874,74.816 61.52,72.261 57.203,69.727"];
86
+ j [_draw_="c 7 -#000000 e 248 438 27 18 ",
87
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 248 433.8 0 3.89 1 -j ",
88
+ height=0.5,
89
+ pos="248,438",
90
+ width=0.75];
91
+ k [_draw_="c 7 -#000000 e 248 366 27 18 ",
92
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 248 361.8 0 7 1 -k ",
93
+ height=0.5,
94
+ pos="248,366",
95
+ width=0.75];
96
+ j -> k [_draw_="c 7 -#000000 B 4 248 419.83 248 412.55 248 403.98 248 395.83 ",
97
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 251.5 395.93 248 385.93 244.5 395.93 ",
98
+ pos="e,248,384.41 248,419.83 248,412.55 248,403.98 248,395.83"];
99
+ l [_draw_="c 7 -#000000 e 248 294 27 18 ",
100
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 248 289.8 0 3.89 1 -l ",
101
+ height=0.5,
102
+ pos="248,294",
103
+ width=0.75];
104
+ k -> l [_draw_="c 7 -#000000 B 4 248 347.83 248 340.55 248 331.98 248 323.83 ",
105
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 251.5 323.93 248 313.93 244.5 323.93 ",
106
+ pos="e,248,312.41 248,347.83 248,340.55 248,331.98 248,323.83"];
107
+ m [_draw_="c 7 -#000000 e 248 222 27 18 ",
108
+ _ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 248 217.8 0 10.89 1 -m ",
109
+ height=0.5,
110
+ pos="248,222",
111
+ width=0.75];
112
+ l -> m [_draw_="c 7 -#000000 B 4 248 275.83 248 268.55 248 259.98 248 251.83 ",
113
+ _hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 251.5 251.93 248 241.93 244.5 251.93 ",
114
+ pos="e,248,240.41 248,275.83 248,268.55 248,259.98 248,251.83"];
115
+ }
@@ -0,0 +1,18 @@
1
+ digraph G {
2
+ mode=hier;
3
+ epsilon=0.5;
4
+ a -> b;
5
+ b -> c;
6
+ c -> d;
7
+ d -> a;
8
+ a -> c;
9
+ e -> f;
10
+ f -> g;
11
+ g -> h;
12
+ h -> e;
13
+ e -> g;
14
+ h -> i;
15
+ j -> k;
16
+ k -> l;
17
+ l -> m;
18
+ }