@kortexya/nodus 0.1.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 (252) hide show
  1. package/LICENSE +37 -0
  2. package/README.md +60 -0
  3. package/__vite-plugin-wasm-helper-1Aiokjk5.js +24 -0
  4. package/assets/hypergraphWorker-DV0aFI3L.js +1 -0
  5. package/assets/layoutWorker-DwDJwbgr.js +285 -0
  6. package/assets/nodus_wasm-C0vDfO5K.js +1 -0
  7. package/chunk-DmhlhrBa.js +11 -0
  8. package/nodus.src.bundle.js +33577 -0
  9. package/nodus_render_wasm-Bs6hlsx-.js +2617 -0
  10. package/nodus_wasm-DKYQVSUZ.js +2789 -0
  11. package/package.json +61 -0
  12. package/types/Nodus.d.ts +100 -0
  13. package/types/algorithms/concentric/index.d.ts +29 -0
  14. package/types/algorithms/concentricFactory.d.ts +43 -0
  15. package/types/algorithms/force/Alea.d.ts +13 -0
  16. package/types/algorithms/force/BVH.d.ts +35 -0
  17. package/types/algorithms/force/LayoutData.d.ts +40 -0
  18. package/types/algorithms/force/Packing.d.ts +31 -0
  19. package/types/algorithms/force/Physics.d.ts +61 -0
  20. package/types/algorithms/force/SEC.d.ts +14 -0
  21. package/types/algorithms/force/Topology.d.ts +3 -0
  22. package/types/algorithms/force/index.d.ts +54 -0
  23. package/types/algorithms/force-gpu/ParticleSystem.d.ts +45 -0
  24. package/types/algorithms/force-gpu/Settings.d.ts +60 -0
  25. package/types/algorithms/force-gpu/Simulation.d.ts +7 -0
  26. package/types/algorithms/force-gpu/getGlContext.d.ts +10 -0
  27. package/types/algorithms/force-gpu/gpuLayout.d.ts +14 -0
  28. package/types/algorithms/force-gpu/index.d.ts +2 -0
  29. package/types/algorithms/force-gpu/kernels/index.d.ts +176 -0
  30. package/types/algorithms/force-gpu/kernels/utils.d.ts +31 -0
  31. package/types/algorithms/force-gpu/shaders/aabb.d.ts +2 -0
  32. package/types/algorithms/force-gpu/shaders/bhExpand.d.ts +2 -0
  33. package/types/algorithms/force-gpu/shaders/bhTranslate.d.ts +2 -0
  34. package/types/algorithms/force-gpu/shaders/cellLookup.d.ts +2 -0
  35. package/types/algorithms/force-gpu/shaders/index.d.ts +9 -0
  36. package/types/algorithms/force-gpu/shaders/integrate.d.ts +2 -0
  37. package/types/algorithms/force-gpu/shaders/morton.d.ts +2 -0
  38. package/types/algorithms/force-gpu/shaders/sortIntervals.d.ts +2 -0
  39. package/types/algorithms/force-gpu/shaders/sortKeys.d.ts +2 -0
  40. package/types/algorithms/force-gpu/shaders/types.d.ts +10 -0
  41. package/types/algorithms/force-gpu/webgl/helpers.d.ts +24 -0
  42. package/types/algorithms/force-gpu/webgl/index.d.ts +4 -0
  43. package/types/algorithms/force-gpu/webgl/program.d.ts +15 -0
  44. package/types/algorithms/forceFactory.d.ts +55 -0
  45. package/types/algorithms/forceLinkFactory.d.ts +40 -0
  46. package/types/algorithms/grid/index.d.ts +26 -0
  47. package/types/algorithms/gridFactory.d.ts +30 -0
  48. package/types/algorithms/hierarchical/index.d.ts +80 -0
  49. package/types/algorithms/hierarchical/sugiyama.d.ts +144 -0
  50. package/types/algorithms/hierarchicalFactory.d.ts +49 -0
  51. package/types/algorithms/index.d.ts +13 -0
  52. package/types/algorithms/radial/index.d.ts +33 -0
  53. package/types/algorithms/radialFactory.d.ts +54 -0
  54. package/types/algorithms/sequential/index.d.ts +37 -0
  55. package/types/algorithms/sequentialFactory.d.ts +37 -0
  56. package/types/core/Edge.d.ts +67 -0
  57. package/types/core/EdgeList.d.ts +86 -0
  58. package/types/core/Node.d.ts +89 -0
  59. package/types/core/NodeList.d.ts +105 -0
  60. package/types/core/Transformation.d.ts +108 -0
  61. package/types/core/enums.d.ts +16 -0
  62. package/types/geometry/BoundingBox.d.ts +41 -0
  63. package/types/geometry/index.d.ts +276 -0
  64. package/types/geometry/types.d.ts +27 -0
  65. package/types/hypergraph/Hypergraph.d.ts +74 -0
  66. package/types/hypergraph/KoenigGraph.d.ts +29 -0
  67. package/types/hypergraph/Simplifier.d.ts +39 -0
  68. package/types/hypergraph/Statistics.d.ts +55 -0
  69. package/types/hypergraph/forbidden/StrangledHyperedge.d.ts +12 -0
  70. package/types/hypergraph/forbidden/StrangledVertex.d.ts +16 -0
  71. package/types/hypergraph/forbidden/ThreeAdjacentCluster2.d.ts +10 -0
  72. package/types/hypergraph/forbidden/TwoAdjacentCluster3.d.ts +14 -0
  73. package/types/hypergraph/forbidden/index.d.ts +22 -0
  74. package/types/hypergraph/index.d.ts +21 -0
  75. package/types/hypergraph/layout/Adam.d.ts +12 -0
  76. package/types/hypergraph/layout/Energy.d.ts +55 -0
  77. package/types/hypergraph/layout/LBFGS.d.ts +32 -0
  78. package/types/hypergraph/layout/Optimizer.d.ts +60 -0
  79. package/types/hypergraph/layout/Reverser.d.ts +42 -0
  80. package/types/hypergraph/operations/AtomicOperation.d.ts +54 -0
  81. package/types/hypergraph/operations/HyperedgeMerger.d.ts +30 -0
  82. package/types/hypergraph/operations/HyperedgeRemoval.d.ts +27 -0
  83. package/types/hypergraph/operations/VertexMerger.d.ts +32 -0
  84. package/types/hypergraph/operations/VertexRemoval.d.ts +30 -0
  85. package/types/hypergraph/operations/index.d.ts +19 -0
  86. package/types/hypergraph/osfkb/adapter.d.ts +315 -0
  87. package/types/hypergraph/render/Interaction.d.ts +40 -0
  88. package/types/hypergraph/render/PolygonRenderer.d.ts +50 -0
  89. package/types/hypergraph/render/SVGPolygonRenderer.d.ts +7 -0
  90. package/types/hypergraph/types.d.ts +170 -0
  91. package/types/index.d.ts +21 -0
  92. package/types/internals/Algorithms.d.ts +68 -0
  93. package/types/internals/AlgorithmsPrimitives.d.ts +18 -0
  94. package/types/internals/Animations.d.ts +39 -0
  95. package/types/internals/AttributePathPrimitives.d.ts +2 -0
  96. package/types/internals/Brand.d.ts +22 -0
  97. package/types/internals/Camera.d.ts +115 -0
  98. package/types/internals/CameraInteractions.d.ts +15 -0
  99. package/types/internals/CameraInteractionsPrimitives.d.ts +18 -0
  100. package/types/internals/Captor.d.ts +56 -0
  101. package/types/internals/CaptorPrimitives.d.ts +9 -0
  102. package/types/internals/ClassModule.d.ts +42 -0
  103. package/types/internals/ConnectNodes.d.ts +23 -0
  104. package/types/internals/CurvatureManager.d.ts +14 -0
  105. package/types/internals/DataModule.d.ts +29 -0
  106. package/types/internals/Disabled.d.ts +27 -0
  107. package/types/internals/DomModule.d.ts +87 -0
  108. package/types/internals/DragModule.d.ts +14 -0
  109. package/types/internals/ElementSet.d.ts +17 -0
  110. package/types/internals/EventsModule.d.ts +41 -0
  111. package/types/internals/FlexArray.d.ts +54 -0
  112. package/types/internals/Geo.d.ts +127 -0
  113. package/types/internals/Graph.d.ts +109 -0
  114. package/types/internals/Graphics.d.ts +112 -0
  115. package/types/internals/GraphicsEngine.d.ts +96 -0
  116. package/types/internals/Hover.d.ts +32 -0
  117. package/types/internals/Hypergraph.d.ts +112 -0
  118. package/types/internals/IndexList.d.ts +28 -0
  119. package/types/internals/IndividualAttributes.d.ts +27 -0
  120. package/types/internals/Interactions.d.ts +45 -0
  121. package/types/internals/Keyboard.d.ts +25 -0
  122. package/types/internals/LabelManager.d.ts +56 -0
  123. package/types/internals/Lasso.d.ts +22 -0
  124. package/types/internals/Layers.d.ts +79 -0
  125. package/types/internals/LayersPrimitives.d.ts +5 -0
  126. package/types/internals/Layouts.d.ts +35 -0
  127. package/types/internals/LayoutsInternal.d.ts +37 -0
  128. package/types/internals/LayoutsPrimitives.d.ts +23 -0
  129. package/types/internals/Legend.d.ts +33 -0
  130. package/types/internals/LegendPrimitives.d.ts +3 -0
  131. package/types/internals/Locate.d.ts +43 -0
  132. package/types/internals/LocatePrimitives.d.ts +20 -0
  133. package/types/internals/MappingManager.d.ts +27 -0
  134. package/types/internals/MappingPrimitives.d.ts +29 -0
  135. package/types/internals/Module.d.ts +23 -0
  136. package/types/internals/Mouse.d.ts +42 -0
  137. package/types/internals/NodusModules.d.ts +99 -0
  138. package/types/internals/PositionModule.d.ts +10 -0
  139. package/types/internals/PulseModule.d.ts +29 -0
  140. package/types/internals/Quadtree.d.ts +100 -0
  141. package/types/internals/RectangleSelect.d.ts +18 -0
  142. package/types/internals/Resizing.d.ts +48 -0
  143. package/types/internals/Rewiring.d.ts +64 -0
  144. package/types/internals/SchemaWatchPrimitives.d.ts +75 -0
  145. package/types/internals/Selection.d.ts +52 -0
  146. package/types/internals/SelectionModule.d.ts +27 -0
  147. package/types/internals/Settings.d.ts +20 -0
  148. package/types/internals/Snapping.d.ts +54 -0
  149. package/types/internals/Spatial.d.ts +50 -0
  150. package/types/internals/SpatialPrimitives.d.ts +75 -0
  151. package/types/internals/Storage.d.ts +46 -0
  152. package/types/internals/StyleRulesModule.d.ts +21 -0
  153. package/types/internals/Synchronizer.d.ts +17 -0
  154. package/types/internals/Tooltip.d.ts +25 -0
  155. package/types/internals/TooltipPrimitives.d.ts +21 -0
  156. package/types/internals/Topology.d.ts +50 -0
  157. package/types/internals/Touch.d.ts +16 -0
  158. package/types/internals/Transformations.d.ts +36 -0
  159. package/types/internals/VirtualMouse.d.ts +52 -0
  160. package/types/internals/WasmHGrid.d.ts +25 -0
  161. package/types/internals/WatcherModule.d.ts +25 -0
  162. package/types/internals/Workers.d.ts +79 -0
  163. package/types/internals/algorithmExports.d.ts +333 -0
  164. package/types/internals/algorithmHelpers.d.ts +36 -0
  165. package/types/internals/attributes/AttributesManager.d.ts +216 -0
  166. package/types/internals/attributes/ElementAttributesManager.d.ts +119 -0
  167. package/types/internals/attributes/attributeHelpers.d.ts +70 -0
  168. package/types/internals/attributes/flexArrayFactories.d.ts +277 -0
  169. package/types/internals/easing.d.ts +15 -0
  170. package/types/internals/helpers.d.ts +79 -0
  171. package/types/internals/hypergraphWorker.d.ts +37 -0
  172. package/types/internals/hypergraphWorkerHost.d.ts +40 -0
  173. package/types/internals/labels/SpatialGrid.d.ts +29 -0
  174. package/types/internals/labels/fillEdgeTexts.d.ts +25 -0
  175. package/types/internals/labels/fillNodeTexts.d.ts +24 -0
  176. package/types/internals/labels/helpers.d.ts +180 -0
  177. package/types/internals/layoutWorker.d.ts +21 -0
  178. package/types/internals/rendering/BoundariesManager.d.ts +53 -0
  179. package/types/internals/rendering/Buffer2.d.ts +91 -0
  180. package/types/internals/rendering/BufferList.d.ts +86 -0
  181. package/types/internals/rendering/CpuRenderer.d.ts +128 -0
  182. package/types/internals/rendering/EasingManager.d.ts +40 -0
  183. package/types/internals/rendering/EdgeDrawer.d.ts +54 -0
  184. package/types/internals/rendering/ElementGroup.d.ts +66 -0
  185. package/types/internals/rendering/MemoryManager.d.ts +71 -0
  186. package/types/internals/rendering/NodeDrawer.d.ts +49 -0
  187. package/types/internals/rendering/PatternManager.d.ts +29 -0
  188. package/types/internals/rendering/RENDER_MAPPING.d.ts +5 -0
  189. package/types/internals/rendering/RendererBase.d.ts +127 -0
  190. package/types/internals/rendering/ShapeManager.d.ts +46 -0
  191. package/types/internals/rendering/TextManager.d.ts +112 -0
  192. package/types/internals/rendering/canvasHelpers.d.ts +5 -0
  193. package/types/internals/rendering/constants.d.ts +125 -0
  194. package/types/internals/rendering/curveHelpers.d.ts +96 -0
  195. package/types/internals/rendering/drawerHelpers.d.ts +32 -0
  196. package/types/internals/rendering/float16.d.ts +25 -0
  197. package/types/internals/rendering/hitDetection.d.ts +89 -0
  198. package/types/internals/rendering/loadGraph.d.ts +103 -0
  199. package/types/internals/rendering/objectInfo.d.ts +46 -0
  200. package/types/internals/rendering/packing.d.ts +46 -0
  201. package/types/internals/rendering/shapeHelpers.d.ts +26 -0
  202. package/types/internals/rendering/types.d.ts +143 -0
  203. package/types/internals/renderingBinaryPrimitives.d.ts +110 -0
  204. package/types/internals/utilsExports.d.ts +408 -0
  205. package/types/internals/wasmBackend.d.ts +38 -0
  206. package/types/internals/wasmColumns.d.ts +61 -0
  207. package/types/internals/wasmInit.d.ts +1 -0
  208. package/types/modules/APIModule.d.ts +8 -0
  209. package/types/modules/AlgorithmsAPI.d.ts +15 -0
  210. package/types/modules/BrandAPI.d.ts +6 -0
  211. package/types/modules/CaptorAPI.d.ts +9 -0
  212. package/types/modules/ClassesAPI.d.ts +9 -0
  213. package/types/modules/DebugAPI.d.ts +18 -0
  214. package/types/modules/DisabledAPI.d.ts +11 -0
  215. package/types/modules/DomAPI.d.ts +9 -0
  216. package/types/modules/EventsAPI.d.ts +16 -0
  217. package/types/modules/ExportAPI.d.ts +23 -0
  218. package/types/modules/GeneratorsAPI.d.ts +12 -0
  219. package/types/modules/GeoAPI.d.ts +20 -0
  220. package/types/modules/GraphAPI.d.ts +26 -0
  221. package/types/modules/GraphicsAPI.d.ts +8 -0
  222. package/types/modules/HypergraphAPI.d.ts +71 -0
  223. package/types/modules/KeyboardAPI.d.ts +6 -0
  224. package/types/modules/LayersAPI.d.ts +7 -0
  225. package/types/modules/LayoutsAPI.d.ts +25 -0
  226. package/types/modules/LegendAPI.d.ts +9 -0
  227. package/types/modules/MouseAPI.d.ts +16 -0
  228. package/types/modules/ParseAPI.d.ts +83 -0
  229. package/types/modules/RulesAPI.d.ts +7 -0
  230. package/types/modules/SchemaAPI.d.ts +9 -0
  231. package/types/modules/SelectionAPI.d.ts +12 -0
  232. package/types/modules/SettingsAPI.d.ts +9 -0
  233. package/types/modules/StylesAPI.d.ts +64 -0
  234. package/types/modules/ToolsAPI.d.ts +68 -0
  235. package/types/modules/TransformationsAPI.d.ts +30 -0
  236. package/types/modules/ViewAPI.d.ts +52 -0
  237. package/types/publicTypes.d.ts +56 -0
  238. package/types/renderers/CanvasRenderer.d.ts +86 -0
  239. package/types/renderers/Renderer.d.ts +13 -0
  240. package/types/renderers/SVGRenderer.d.ts +57 -0
  241. package/types/renderers/WasmGraphRenderer.d.ts +118 -0
  242. package/types/renderers/WasmRendererAdapter.d.ts +38 -0
  243. package/types/tools/ConnectNodesAPI.d.ts +42 -0
  244. package/types/tools/LassoAPI.d.ts +78 -0
  245. package/types/tools/RectangleSelectAPI.d.ts +51 -0
  246. package/types/tools/ResizingAPI.d.ts +62 -0
  247. package/types/tools/RewiringAPI.d.ts +78 -0
  248. package/types/tools/SnappingAPI.d.ts +71 -0
  249. package/types/tools/ToolsAPI.d.ts +46 -0
  250. package/types/tools/TooltipAPI.d.ts +141 -0
  251. package/types/transformations/TransformationsEngine.d.ts +602 -0
  252. package/types/utils/index.d.ts +6 -0
@@ -0,0 +1,315 @@
1
+ /**
2
+ * OSFKB → Nodus adapter.
3
+ *
4
+ * Maps an OSFKB `VisualizationGraph` (Rust DTO at
5
+ * `osfkb/crates/api/src/dto/visualization.rs`) into:
6
+ * - an Nodus node-link graph for `nodus.setGraph({ nodes, edges })`
7
+ * - a hypergraph for `nodus.hypergraph.setData({ vertices, hyperedges })`
8
+ *
9
+ * The two are linked by id: each polygon vertex's `nodeId` is the same
10
+ * id as its corresponding Nodus node, so dragging an Nodus node moves the
11
+ * polygon corner in lockstep (when `vertex.nodeId` is honored — see
12
+ * `src/internals/Hypergraph.ts`).
13
+ *
14
+ * Endpoint shapes covered: hypergraph (POST .../visualization/hypergraph)
15
+ * and lattice (POST .../visualization/lattice). Both return a top-level
16
+ * `graph: VisualizationGraphDto` (response shape differs only in the
17
+ * surrounding stats / components fields).
18
+ */
19
+ import type { HypergraphData } from '../types';
20
+ export interface OsfkbGraphNode {
21
+ id: string;
22
+ label: string;
23
+ node_type: string | {
24
+ Custom: string;
25
+ };
26
+ entity_id?: string;
27
+ size?: number;
28
+ color?: string;
29
+ level?: number;
30
+ properties?: Record<string, string>;
31
+ }
32
+ export interface OsfkbGraphEdge {
33
+ id: string;
34
+ source: string;
35
+ target: string;
36
+ label?: string;
37
+ edge_type: string | {
38
+ Custom: string;
39
+ };
40
+ weight?: number;
41
+ curvature?: number;
42
+ color?: string;
43
+ properties?: Record<string, string>;
44
+ }
45
+ export interface OsfkbHyperedge {
46
+ id: string;
47
+ label?: string;
48
+ nodes: string[];
49
+ ordered: boolean;
50
+ hyperedge_type: string | {
51
+ Custom: string;
52
+ };
53
+ source_term_id?: string;
54
+ color?: string;
55
+ properties?: Record<string, string>;
56
+ }
57
+ export interface OsfkbVisualizationGraph {
58
+ graph_id?: string;
59
+ metadata?: {
60
+ title?: string;
61
+ description?: string;
62
+ node_count?: number;
63
+ edge_count?: number;
64
+ hyperedge_count?: number;
65
+ };
66
+ nodes: OsfkbGraphNode[];
67
+ edges: OsfkbGraphEdge[];
68
+ hyperedges: OsfkbHyperedge[];
69
+ layout?: {
70
+ algorithm?: string;
71
+ direction?: string;
72
+ };
73
+ }
74
+ /** Either endpoint wraps `graph: VisualizationGraphDto`. */
75
+ export interface OsfkbVisualizationResponse {
76
+ graph: OsfkbVisualizationGraph;
77
+ /** Present on /hypergraph responses — Aït-Kaci coreference groups. */
78
+ coreferences?: OsfkbCoreferenceGroup[];
79
+ /** Present on /derivation responses. */
80
+ iterations?: number;
81
+ fixpoint_reached?: boolean;
82
+ derived_count?: number;
83
+ rule_application_count?: number;
84
+ }
85
+ export interface OsfkbCoreferenceGroup {
86
+ target_term_id: string;
87
+ tag: string;
88
+ references: Array<{
89
+ term_id: string;
90
+ feature_name: string;
91
+ }>;
92
+ }
93
+ /** Nodus node descriptor — minimal shape `nodus.setGraph` accepts. */
94
+ export interface NodusGraphNode {
95
+ id: string;
96
+ attributes: {
97
+ x: number;
98
+ y: number;
99
+ radius: number;
100
+ color: string;
101
+ text?: {
102
+ content?: string;
103
+ };
104
+ };
105
+ data?: any;
106
+ }
107
+ /** Nodus edge descriptor. */
108
+ export interface NodusGraphEdge {
109
+ id: string;
110
+ source: string;
111
+ target: string;
112
+ attributes?: {
113
+ color?: string;
114
+ width?: number;
115
+ };
116
+ data?: any;
117
+ }
118
+ export interface OsfkbAdapterResult {
119
+ /** Nodus underlying node-link graph (term/sort/feature nodes + binary edges). */
120
+ nodusGraph: {
121
+ nodes: NodusGraphNode[];
122
+ edges: NodusGraphEdge[];
123
+ };
124
+ /** Hypergraph data for `nodus.hypergraph.setData(...)`. */
125
+ hypergraph: HypergraphData;
126
+ /** Convenience: id → original OSFKB node so caller can hydrate UI. */
127
+ nodeIndex: Map<string, OsfkbGraphNode>;
128
+ /** Convenience: id → original OSFKB hyperedge. */
129
+ hyperedgeIndex: Map<string, OsfkbHyperedge>;
130
+ /** Aït-Kaci coreference groups echoed through from the OSFKB
131
+ * response (the same Ψ-term referenced from multiple feature
132
+ * occurrences). Renderers paint these as identity edges with the
133
+ * shared "X" tag. */
134
+ coreferences: OsfkbCoreferenceGroup[];
135
+ /** True if this is a derivation-lattice response (different
136
+ * coloring conventions; rules vs. facts). */
137
+ isDerivation: boolean;
138
+ }
139
+ export interface AdaptOptions {
140
+ /** Initial radius for the ring layout placeholder. Default 600. */
141
+ initialRadius?: number;
142
+ /** Per-node radius. Default 6. */
143
+ nodeRadius?: number;
144
+ /** Color palette indexed by hyperedge_type. Falls back to default. */
145
+ hyperedgeColors?: Partial<Record<string, string>>;
146
+ /** Skip OSFKB Feature nodes (they make the underlying graph noisy
147
+ * because each Ψ-term feature becomes its own dot). Default false. */
148
+ collapseFeatureNodes?: boolean;
149
+ }
150
+ /**
151
+ * Tenant-agnostic category extractor. Splits the node name on common
152
+ * separators and returns the first segment, falling back to `node_type`
153
+ * and finally to `(uncategorized)`. This is purely structural — it has
154
+ * no knowledge of any specific dataset's vocabulary. Tenants whose
155
+ * naming uses different conventions can supply a custom extractor at
156
+ * runtime via `viewer-config.json` (the example HTML invokes that
157
+ * override before passing nodes to the adapter; the adapter itself
158
+ * stays defaults-only).
159
+ *
160
+ * Exported so the example HTML can also call it for any side-channel
161
+ * nodes it constructs (search-result hydration, etc.).
162
+ */
163
+ export declare function defaultExtractCategory(node: OsfkbGraphNode): string;
164
+ /**
165
+ * Convert an OSFKB `VisualizationGraph` (or response wrapper) into the
166
+ * shapes Nodus needs.
167
+ */
168
+ export declare function adaptOsfkbGraph(source: OsfkbVisualizationGraph | OsfkbVisualizationResponse, options?: AdaptOptions): OsfkbAdapterResult;
169
+ export interface OsfkbClientOptions {
170
+ /** Base URL, no trailing slash. e.g. http://127.0.0.1:8080 */
171
+ baseUrl: string;
172
+ /** Required: tenant UUID for `X-Tenant-Id` header. */
173
+ tenantId: string;
174
+ /** Optional headers (namespace, user, ...). Merged with the auth header. */
175
+ headers?: Record<string, string>;
176
+ }
177
+ export declare function fetchOsfkbHypergraph(client: OsfkbClientOptions, body: {
178
+ root_term_id: string;
179
+ max_depth?: number;
180
+ include_hyperedges?: boolean;
181
+ include_relations?: boolean;
182
+ s_threshold?: number;
183
+ }): Promise<OsfkbVisualizationResponse>;
184
+ export declare function fetchOsfkbLattice(client: OsfkbClientOptions, body?: {
185
+ root_sort_id?: string;
186
+ max_depth?: number;
187
+ /** Page size; 0 = unlimited. Default 500 server-side. */
188
+ limit?: number;
189
+ /** Page offset. */
190
+ offset?: number;
191
+ }): Promise<OsfkbVisualizationResponse>;
192
+ /**
193
+ * Walk every page of the lattice endpoint and merge into a single
194
+ * response. Dedupes nodes by `id` and edges by `id` (server emits
195
+ * UUID-derived stable ids so accumulating pages reconstructs the
196
+ * same graph as a single unpaginated call).
197
+ *
198
+ * Optional `onPage(partial)` callback fires after each page is
199
+ * accumulated, with the cumulative response so far — letting the UI
200
+ * render incrementally without waiting for all pages to land.
201
+ */
202
+ export declare function fetchOsfkbLatticeAll(client: OsfkbClientOptions, body?: {
203
+ root_sort_id?: string;
204
+ max_depth?: number;
205
+ }, pageSize?: number, onProgress?: (loaded: number, total: number) => void, onPage?: (partial: OsfkbVisualizationResponse) => void | Promise<void>): Promise<OsfkbVisualizationResponse>;
206
+ /**
207
+ * Fetch the forward-chain derivation lattice. Runs the homoiconic
208
+ * chainer with provenance enabled and returns a meta-hypergraph in the
209
+ * standard `VisualizationGraph` shape:
210
+ * - Term nodes for each Ψ-term (assertion, rule, derivation)
211
+ * - Rule nodes (NodeType::Rule, distinct color)
212
+ * - Edge per (antecedent → derived) and (rule → derived)
213
+ * - Hyperedge per rule application grouping rule + antecedents +
214
+ * produced fact
215
+ */
216
+ export declare function fetchOsfkbDerivation(client: OsfkbClientOptions, body?: {
217
+ max_iterations?: number;
218
+ include_aggregates?: boolean;
219
+ focus_term_ids?: string[];
220
+ }): Promise<OsfkbVisualizationResponse>;
221
+ /** Fetch residuation state diagram for visual overlay (witness state). */
222
+ export declare function fetchOsfkbResiduation(client: OsfkbClientOptions, body?: any): Promise<any>;
223
+ /** Fetch a single term to get its current witness state (Complete /
224
+ * Residuated / NoWitnesses). Used by the demo's witness overlay. */
225
+ export declare function fetchOsfkbTermState(client: OsfkbClientOptions, termId: string): Promise<{
226
+ state: 'complete' | 'residuated' | 'no_witnesses';
227
+ term: any;
228
+ }>;
229
+ /** Term-level unification (`⊔`) or anti-unification (`⊓`) — operates
230
+ * on Ψ-terms directly (vs. the sort-only `/api/v1/sorts/{glb,lub}`).
231
+ * Returns operand1 + operand2 + result as a polygon graph the
232
+ * renderer can animate as a merge. */
233
+ export declare function fetchOsfkbUnifyTerms(client: OsfkbClientOptions, body: {
234
+ term1_id: string;
235
+ term2_id: string;
236
+ op?: 'unify' | 'anti_unify';
237
+ }): Promise<OsfkbVisualizationResponse>;
238
+ /** Fetch the LIFE function definitions in the tenant's term store. */
239
+ export declare function fetchOsfkbFunctions(client: OsfkbClientOptions, body?: {
240
+ name_prefix?: string;
241
+ limit?: number;
242
+ }): Promise<OsfkbVisualizationResponse>;
243
+ /** Diff two MVCC branches of the tenant's term store. */
244
+ export declare function fetchOsfkbBranchDiff(client: OsfkbClientOptions, body: {
245
+ branch_a: string;
246
+ branch_b: string;
247
+ limit?: number;
248
+ }): Promise<OsfkbVisualizationResponse>;
249
+ /** Issue an OSFQL query and return the result Ψ-term set wrapped in
250
+ * a visualization-friendly shape (`{graph: VisualizationGraph}`).
251
+ * When the OSFQL endpoint returns a flat term list, this helper
252
+ * fetches each one's hypergraph and concatenates the results. */
253
+ export declare function fetchOsfkbOsfqlAsGraph(client: OsfkbClientOptions, query: string): Promise<OsfkbVisualizationResponse>;
254
+ /** Fuzzy unification on two Ψ-terms — returns a membership grade
255
+ * ∈ [0, 1]. Used by the demo to render the merge polygon with
256
+ * opacity = grade. */
257
+ export declare function fetchOsfkbFuzzyUnify(client: OsfkbClientOptions, body: {
258
+ term1_id: string;
259
+ term2_id: string;
260
+ }): Promise<{
261
+ grade: number;
262
+ result_term_id?: string;
263
+ bindings?: any[];
264
+ }>;
265
+ /** Fetch the graded-poset projection of the sort hierarchy. */
266
+ export declare function fetchOsfkbGradedPoset(client: OsfkbClientOptions, body?: {
267
+ include_lower_adjacencies?: boolean;
268
+ include_upper_adjacencies?: boolean;
269
+ /** Page size; 0 = unlimited. Default 500 server-side. */
270
+ limit?: number;
271
+ /** Page offset. */
272
+ offset?: number;
273
+ }): Promise<OsfkbVisualizationResponse>;
274
+ /**
275
+ * Walk every page of the graded-poset endpoint and merge into a
276
+ * single response. Dedupes nodes/edges by id (UUID-derived).
277
+ *
278
+ * Optional `onPage(partial)` callback fires after each page is
279
+ * accumulated — lets the UI render incrementally.
280
+ */
281
+ export declare function fetchOsfkbGradedPosetAll(client: OsfkbClientOptions, body?: {
282
+ include_lower_adjacencies?: boolean;
283
+ include_upper_adjacencies?: boolean;
284
+ }, pageSize?: number, onProgress?: (loaded: number, total: number) => void, onPage?: (partial: OsfkbVisualizationResponse) => void | Promise<void>): Promise<OsfkbVisualizationResponse>;
285
+ /**
286
+ * Fetch an N-hop neighborhood around a focus sort. Designed for
287
+ * tenants with millions of sorts — instead of trying to load the
288
+ * entire lattice, the client picks a focus and asks for a bounded
289
+ * subgraph. Returns at most `max_nodes` (default 5000); when the
290
+ * BFS reaches more than that, the response sets `truncated: true`.
291
+ */
292
+ export declare function fetchOsfkbSortNeighborhood(client: OsfkbClientOptions, body: {
293
+ sort_id: string;
294
+ hops?: number;
295
+ max_nodes?: number;
296
+ include_ancestors?: boolean;
297
+ include_descendants?: boolean;
298
+ include_siblings?: boolean;
299
+ }): Promise<OsfkbVisualizationResponse & {
300
+ truncated?: boolean;
301
+ reachable_count?: number;
302
+ emitted_count?: number;
303
+ }>;
304
+ /** Subscribe to the forward-chain SSE stream and call onStep for each
305
+ * derivation event. Returns an EventSource handle so the caller can
306
+ * close() when done. */
307
+ export declare function subscribeOsfkbDerivationStream(client: OsfkbClientOptions, onStep: (step: {
308
+ iteration: number;
309
+ rule_id: string;
310
+ derived_fact: string;
311
+ antecedents: string[];
312
+ }) => void, onError?: (err: any) => void): EventSource;
313
+ /** Fetch GLB / LUB of two sorts — used by the unify visual diff
314
+ * to compute the join of two selected term sorts in the lattice. */
315
+ export declare function fetchOsfkbGlbLub(client: OsfkbClientOptions, op: 'glb' | 'lub', sortIds: string[]): Promise<any>;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Hit-testing helpers for hypergraph interaction.
3
+ *
4
+ * Given a screen-space mouse position, return the topmost hyperedge or
5
+ * vertex under the pointer. The renderer paints hyperedges in iteration
6
+ * order, so the *last* matching hyperedge is the visual top.
7
+ */
8
+ import type { Hypergraph } from '../Hypergraph';
9
+ import type { HypergraphId, Vec2 } from '../types';
10
+ export interface HitTestState {
11
+ H: Hypergraph;
12
+ positions: Map<HypergraphId, Vec2>;
13
+ dualPositions?: Map<HypergraphId, Vec2>;
14
+ showVertices: boolean;
15
+ vertexRadius: number;
16
+ /** 'primal' | 'dual' | 'both' — which set of polygons to hit-test. */
17
+ view: 'primal' | 'dual' | 'both';
18
+ }
19
+ export interface HitResult {
20
+ hyperedge: HypergraphId | null;
21
+ /** When `view` is 'dual' or 'both', a hit may be a *dual hyperedge*
22
+ * (which corresponds to a primal vertex). We expose it as `dualOf` so
23
+ * callers can treat it as either a vertex hit or a dual-polygon hit. */
24
+ dualOf: HypergraphId | null;
25
+ vertex: HypergraphId | null;
26
+ }
27
+ /**
28
+ * Hit-test against polygons + vertex dots in z-order (last drawn wins).
29
+ *
30
+ * Returns the topmost hit. Caller decides whether to prioritize vertex
31
+ * or polygon — this function returns all three, with `vertex` set when
32
+ * the cursor is within `vertexRadius` of any vertex (vertices draw on
33
+ * top of polygons in our renderer).
34
+ */
35
+ export declare function hitTest(state: HitTestState, worldX: number, worldY: number, zoom: number): HitResult;
36
+ /**
37
+ * Convert screen position to world (graph) coordinates using Nodus's
38
+ * camera.
39
+ */
40
+ export declare function screenToWorld(nodus: any, x: number, y: number): Vec2;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Canvas overlay polygon renderer for hypergraphs.
3
+ *
4
+ * Draws each hyperedge as a filled convex polygon whose corners are the
5
+ * incident-vertex positions, sorted CCW around the centroid. Renderer-
6
+ * agnostic: this works above any Nodus host renderer (Canvas / WebGL /
7
+ * WebGPU) because Nodus's `Layers.render()` (`src/internals/Layers.ts`)
8
+ * applies the camera world-to-screen transform inside the layer's own
9
+ * canvas regardless of which renderer is drawing the underlying graph.
10
+ */
11
+ import type { Hypergraph } from '../Hypergraph';
12
+ import type { HypergraphId, HypergraphRenderOptions, Vec2 } from '../types';
13
+ export interface PolygonRenderState {
14
+ H: Hypergraph;
15
+ positions: Map<HypergraphId, Vec2>;
16
+ /** Optional dual positions; when provided the dual layer can render. */
17
+ dualPositions?: Map<HypergraphId, Vec2>;
18
+ options: Required<Omit<HypergraphRenderOptions, 'palette'>> & {
19
+ palette: HypergraphRenderOptions['palette'];
20
+ };
21
+ /** Currently-hovered primal hyperedge id. */
22
+ hoveredHyperedge?: HypergraphId | null;
23
+ /** Hovered dual hyperedge (corresponds to a primal vertex). */
24
+ hoveredDualOf?: HypergraphId | null;
25
+ /** Currently-hovered vertex id. */
26
+ hoveredVertex?: HypergraphId | null;
27
+ /** Selection sets. */
28
+ selectedHyperedges?: Set<HypergraphId>;
29
+ selectedVertices?: Set<HypergraphId>;
30
+ }
31
+ export declare function applyDefaults(opts?: HypergraphRenderOptions): PolygonRenderState['options'];
32
+ /**
33
+ * Oblique-projection 2.5D mapping. Treats every polygon as living on a
34
+ * horizontal slab at z = level × levelSpacing, then projects to screen
35
+ * space with a constant tilt so multiple slabs are visible without a
36
+ * full 3D camera. The optimizer remains 2D — only the renderer changes.
37
+ *
38
+ * The mapping is `(x, y, level) → (x + tilt_x · level, y − tilt_y ·
39
+ * level)` with `tilt_y = sin(angle) × levelSpacing` and a small
40
+ * x-offset proportional to level for parallax. This produces a
41
+ * topographic-map view that reads as "depth-1 sorts are nearer
42
+ * camera, depth-N sorts are further away".
43
+ */
44
+ export declare function project25D(pos: Vec2, level: number, levelSpacing: number, tilt: number): Vec2;
45
+ /**
46
+ * Build the canvas draw function. Calls `stateProvider()` on every
47
+ * frame so the draw fn always sees the latest positions (the optimizer
48
+ * replaces the position map by reference once it finishes).
49
+ */
50
+ export declare function createPolygonDraw(nodus: any, stateProvider: () => PolygonRenderState): (ctx: CanvasRenderingContext2D) => void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * SVG-layer polygon renderer for hypergraphs (parallel path to the
3
+ * Canvas renderer). Used when the host Nodus renderer is SVG, or when
4
+ * the user explicitly requests `layer: 'svg'` for export.
5
+ */
6
+ import type { PolygonRenderState } from './PolygonRenderer';
7
+ export declare function createSVGDraw(stateProvider: () => PolygonRenderState): (root: SVGElement) => void;
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Public types for the hypergraph subsystem.
3
+ * Implements the data model from Oliver et al., "Scalable Hypergraph
4
+ * Visualization" (TVCG 2023, arXiv:2308.05043).
5
+ */
6
+ export type HypergraphId = string | number;
7
+ export interface HypergraphVertex<VData = any> {
8
+ id: HypergraphId;
9
+ /** When set, binds this vertex to an existing Nodus node so positions track. */
10
+ nodeId?: any;
11
+ data?: VData;
12
+ }
13
+ export interface HypergraphHyperedge<EData = any> {
14
+ id: HypergraphId;
15
+ /** Vertex ids that this hyperedge is incident to. Cardinality = vertices.length. */
16
+ vertices: HypergraphId[];
17
+ data?: EData;
18
+ }
19
+ export interface HypergraphData<VData = any, EData = any> {
20
+ vertices: HypergraphVertex<VData>[];
21
+ hyperedges: HypergraphHyperedge<EData>[];
22
+ }
23
+ export type ForbiddenSubgraphKind = '3a2' | '2a3' | 'strangledV' | 'strangledE';
24
+ export interface ForbiddenSubgraph {
25
+ kind: ForbiddenSubgraphKind;
26
+ vertices: HypergraphId[];
27
+ hyperedges: HypergraphId[];
28
+ }
29
+ export type AtomicOperationKind = 'vertexRemoval' | 'hyperedgeRemoval' | 'vertexMerger' | 'hyperedgeMerger';
30
+ /** Record produced by the simplifier and consumed by the reverser. */
31
+ export interface AtomicOperationRecord {
32
+ kind: AtomicOperationKind;
33
+ /** Vertex(es) operated on. For removal: [removed]. For merger: [retained, removed]. */
34
+ vertices: HypergraphId[];
35
+ /** Hyperedges operated on. Same convention as vertices. */
36
+ hyperedges: HypergraphId[];
37
+ /** Footprint at apply time: V_O ∪ V_v ∪ ... — used for local reversal. */
38
+ footprintVertices: HypergraphId[];
39
+ footprintHyperedges: HypergraphId[];
40
+ /** Snapshot needed to restore (e.g. for vertex merger: which hyperedges contained the removed vertex). */
41
+ snapshot?: any;
42
+ }
43
+ export interface SimplificationOptions {
44
+ /** Priority weights from paper Eq. (1). */
45
+ alpha?: number;
46
+ beta?: number;
47
+ gamma?: number;
48
+ /** Power t in adjacency factor Adj_t. Paper recommends t = 2. */
49
+ adjacencyT?: number;
50
+ maxScales?: number;
51
+ /** Termination criterion (paper §5.1):
52
+ * - 'linear': stop once H is linear (every pair of hyperedges shares ≤1 vertex)
53
+ * - 'noForbidden': stop once linear AND no forbidden sub-hypergraphs remain (default)
54
+ * - 'targetVertices': stop when |V(H)| ≤ targetVertexCount
55
+ * - 'targetHyperedges': stop when |E(H)| ≤ targetHyperedgeCount
56
+ * - 'manual': run until queue exhausts or maxScales reached */
57
+ stopWhen?: 'linear' | 'noForbidden' | 'targetVertices' | 'targetHyperedges' | 'manual';
58
+ /** Lower-bound vertex count when stopWhen = 'targetVertices'. */
59
+ targetVertexCount?: number;
60
+ /** Lower-bound hyperedge count when stopWhen = 'targetHyperedges'. */
61
+ targetHyperedgeCount?: number;
62
+ forbiddenSubgraphs?: ForbiddenSubgraphKind[];
63
+ /** Recompute betweenness every K ops. 0 = compute once on H_0 only
64
+ * (paper-faithful). Default 0. */
65
+ betweennessRefreshEvery?: number;
66
+ }
67
+ export interface LayoutWeights {
68
+ regularity: number;
69
+ area: number;
70
+ separation: number;
71
+ intersection: number;
72
+ coordination: number;
73
+ }
74
+ export interface LayoutOptions {
75
+ weights?: Partial<LayoutWeights>;
76
+ separationIters?: number;
77
+ regularityIters?: number;
78
+ solver?: 'lbfgs' | 'adam';
79
+ /** Whether to optimize the dual hypergraph simultaneously (paper-faithful). */
80
+ optimizeDual?: boolean;
81
+ /** Map from hyperedge cardinality to target polygon area. Default k → 80·k.
82
+ * This option is dropped silently when running in a worker (functions
83
+ * can't cross postMessage); pass `useWorker: false` to honor it. */
84
+ targetAreaPerCardinality?: (k: number) => number;
85
+ /** Buffer distance d_b in separation energy. Default 10. */
86
+ bufferDistance?: number;
87
+ /** Run the L-BFGS optimization in a Web Worker so the main thread
88
+ * stays interactive. Default true. Falls back to inline execution
89
+ * when Workers are unavailable or when a worker run errors out. */
90
+ useWorker?: boolean;
91
+ /** Throttle the worker → main progress stream — emit one event per N
92
+ * L-BFGS iterations to avoid saturating postMessage. Default 25. */
93
+ progressEvery?: number;
94
+ onProgress?: (info: LayoutProgress) => void;
95
+ }
96
+ export interface LayoutProgress {
97
+ scale: number;
98
+ phase: 'separation' | 'regularity' | 'reversal';
99
+ iter: number;
100
+ energy: number;
101
+ }
102
+ export interface HypergraphRenderOptions {
103
+ fillOpacity?: number;
104
+ strokeOpacity?: number;
105
+ /** Either an array (cycled by index) or a function of the hyperedge. */
106
+ palette?: string[] | ((he: HypergraphHyperedge, index: number) => string);
107
+ showVertices?: boolean;
108
+ showIncidenceEdges?: boolean;
109
+ /** Layer position relative to Nodus's main render layer. */
110
+ position?: 'below' | 'above';
111
+ layer?: 'canvas' | 'svg';
112
+ view?: 'primal' | 'dual' | 'both' | '2.5d';
113
+ /** When `view === '2.5d'`, returns the lattice depth of a vertex
114
+ * (root = 0, deeper = larger). Each polygon is rendered on a slab
115
+ * whose z-elevation is `level * levelSpacing`, projected obliquely
116
+ * to 2D screen space. Defaults to reading `vertex.data?.level`,
117
+ * `vertex.data?.osfkb?.level`, or 0. */
118
+ levelOf?: (v: HypergraphVertex) => number;
119
+ /** World-space spacing between successive 2.5D levels. Default 200. */
120
+ levelSpacing?: number;
121
+ /** Oblique-projection tilt angle (radians). 0 = flat 2D, π/2 =
122
+ * side-on. Default π/6 (30°) — a topographic-map look. Only used
123
+ * when `view === '2.5d'`. */
124
+ obliqueTilt?: number;
125
+ /** Pixel-radius of the vertex dots when showVertices is true. */
126
+ vertexRadius?: number;
127
+ /** Multiplier on fill opacity for the hovered polygon. Default 2.2 (capped at 1). */
128
+ hoverFillOpacityScale?: number;
129
+ /** Stroke width (in CSS pixels) for the hovered polygon. Default 3. */
130
+ hoverStrokeWidth?: number;
131
+ /** Stroke color for selected polygons (CSS color). Default '#fbbf24'. */
132
+ selectionStrokeColor?: string;
133
+ /** Stroke width (CSS pixels) for selected polygons. Default 3. */
134
+ selectionStrokeWidth?: number;
135
+ /** Dash pattern for selected polygon outline. Default [6, 4]. */
136
+ selectionDash?: number[];
137
+ /** Whether mouse hover/click events are enabled. Default true. */
138
+ interactive?: boolean;
139
+ /** Optional per-hyperedge opacity multiplier (returns 0..1). When
140
+ * provided, the polygon renderer scales `fillOpacity` by this
141
+ * value — used by the provenance / certainty overlay so polygons
142
+ * fade with their semiring tag. */
143
+ hyperedgeOpacity?: (he: HypergraphHyperedge) => number;
144
+ /** Per-vertex tag string. When provided + truthy, the renderer
145
+ * draws a small label badge at the vertex position. Used for
146
+ * Aït-Kaci coreference X-tags. */
147
+ vertexTag?: (v: HypergraphVertex) => string | null | undefined;
148
+ }
149
+ export interface InteractionEvent {
150
+ /** Hyperedge id under cursor, if any. */
151
+ hyperedge: HypergraphId | null;
152
+ /** Primal-vertex id when the dual polygon was hit (its dual is a hyperedge in H'). */
153
+ dualOf: HypergraphId | null;
154
+ /** Vertex id under cursor (vertex dots take priority over polygons). */
155
+ vertex: HypergraphId | null;
156
+ /** World-space cursor position. */
157
+ world: Vec2;
158
+ /** Original DOM mouse event, if available. */
159
+ domEvent?: MouseEvent;
160
+ }
161
+ export interface QualityMetrics {
162
+ overlapCount: number;
163
+ overlapArea: number;
164
+ avgRegularity: number;
165
+ forbiddenSubgraphCount: number;
166
+ }
167
+ export interface Vec2 {
168
+ x: number;
169
+ y: number;
170
+ }
@@ -0,0 +1,21 @@
1
+ import './internals/wasmInit';
2
+ export { Nodus } from './Nodus';
3
+ export { WasmGraphRenderer } from './renderers/WasmGraphRenderer';
4
+ export { WasmRendererAdapter } from './renderers/WasmRendererAdapter';
5
+ /** WebGPU capability check (the Rust/wgpu renderer prefers WebGPU, falls back to WebGL2). */
6
+ export declare const isWebGpuSupported: () => boolean;
7
+ export { Node } from './core/Node';
8
+ export { Edge } from './core/Edge';
9
+ export { NodeList } from './core/NodeList';
10
+ export { EdgeList } from './core/EdgeList';
11
+ export { Transformation } from './core/Transformation';
12
+ export { StyleRule, StyleClass } from './modules/StylesAPI';
13
+ export { NonObjectPropertyWatcher, ObjectPropertyWatcher } from './modules/SchemaAPI';
14
+ export { BoundingBox } from './geometry/BoundingBox';
15
+ export * as hypergraph from './hypergraph/index';
16
+ export type { HypergraphData, HypergraphVertex, HypergraphHyperedge, HypergraphId, HypergraphRenderOptions, InteractionEvent, SimplificationOptions, LayoutOptions, LayoutWeights, LayoutProgress, QualityMetrics, AtomicOperationKind, AtomicOperationRecord, ForbiddenSubgraph, ForbiddenSubgraphKind, } from './hypergraph/types';
17
+ export * as geometry from './geometry/index';
18
+ export * as parse from './modules/ParseAPI';
19
+ export { radialFactory, forceFactory, forceLinkFactory, gridFactory, hierarchicalFactory, sequentialFactory, concentricFactory, } from './modules/LayoutsAPI';
20
+ export { enableWasmBackend, configureBackends, useWasm, type Subsystem, type Backend } from './internals/wasmBackend';
21
+ export { Nodus as default } from './Nodus';
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Algorithms — graph algorithms: shortest path, cycle detection, MST, BFS, DFS, betweenness.
3
+ * Faithfully translated from /tmp/nodus_extracted/Algorithms.js
4
+ */
5
+ import { Module } from './Module';
6
+ export declare class Algorithms extends Module {
7
+ private _nodeList;
8
+ private _edgeList;
9
+ private _sourceList;
10
+ private _targetList;
11
+ private _excludedList;
12
+ private _virtualList;
13
+ onMounted(): void;
14
+ shortestPath(opts?: {
15
+ source?: any;
16
+ target?: any;
17
+ directed?: boolean;
18
+ edges?: any;
19
+ nodes?: any;
20
+ edgeCostFunction?: (edge: any) => number;
21
+ heuristicFunction?: (node: any, target: any) => number;
22
+ }): Promise<any>;
23
+ private _constructPath;
24
+ /**
25
+ * Whole-graph unit-cost shortest path via the Rust GraphCore A* (byte-exact with the TS A* —
26
+ * see shortest-path-exact-parity). Snapshots the live graph into a GraphCore (live element
27
+ * indexes used as ids, added in the live node/edge order so the adjacency — and thus the
28
+ * PrioritySet tie-break — matches), runs the Rust A*, then maps the gc indexes back to live
29
+ * indexes and builds the same { nodes, edges } NodeList/EdgeList result as _constructPath.
30
+ */
31
+ private _pathCore;
32
+ private _pathCoreKey;
33
+ /**
34
+ * The WHOLE-graph GraphCore, cached + rebuilt only when the node/edge Storage version changes
35
+ * (a structural mutation). Eliminates the O(V+E) per-call rebuild for repeated pathfinding on
36
+ * a static graph. Built from the live node/edge `_indexes` order so the adjacency (and the
37
+ * PrioritySet tie-break) is byte-exact. Safe because shortestPath's wasm guard only fires for
38
+ * the whole graph (no node/edge subgraph).
39
+ */
40
+ private _wholeGraphCore;
41
+ private _shortestPathWasm;
42
+ detectCycle(nodes: any, edges: any): any;
43
+ /** Directed cycle detection via the Rust GraphCore (byte-exact with detectCyclesDirected). */
44
+ private _detectCycleWasm;
45
+ getAllSimpleCycles(nodes: any, edges: any): any[];
46
+ /** All simple cycles via the Rust GraphCore (byte-exact with CyclesFinder, discovery order). */
47
+ private _allSimpleCyclesWasm;
48
+ minimumSpanningTree(nodes: any, edges: any, weightFn?: (edge: any) => number): any[];
49
+ bfs({ root, onNode, onEdge, directed }: {
50
+ root: any;
51
+ onNode: (n: any) => boolean | void;
52
+ onEdge?: (e: any) => boolean | void;
53
+ directed?: boolean;
54
+ }): void;
55
+ dfs({ root, onNode, onEdge, directed }: {
56
+ root: any;
57
+ onNode: (n: any) => boolean | void;
58
+ onEdge?: (e: any) => boolean | void;
59
+ directed?: boolean;
60
+ }): void;
61
+ betweenness({ nodes, edges, directed, normalized }: {
62
+ nodes: any;
63
+ edges: any;
64
+ directed: boolean;
65
+ normalized: boolean;
66
+ }): any;
67
+ fishEyeExpand(nodes: any, _edges: any, k: number, opts: any): any;
68
+ }