graphbox 1.0.0 → 1.0.5

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 (416) hide show
  1. package/README.md +191 -0
  2. package/dist/__tests__/analyzer.unit.test.d.ts +2 -0
  3. package/dist/__tests__/analyzer.unit.test.d.ts.map +1 -0
  4. package/dist/__tests__/constraints.unit.test.d.ts +5 -0
  5. package/dist/__tests__/constraints.unit.test.d.ts.map +1 -0
  6. package/dist/__tests__/generator.unit.test.d.ts +5 -0
  7. package/dist/__tests__/generator.unit.test.d.ts.map +1 -0
  8. package/dist/__tests__/graph-properties.unit.test.d.ts +2 -0
  9. package/dist/__tests__/graph-properties.unit.test.d.ts.map +1 -0
  10. package/dist/__tests__/graph-validator.unit.test.d.ts +5 -0
  11. package/dist/__tests__/graph-validator.unit.test.d.ts.map +1 -0
  12. package/dist/algorithms/analysis/connected-components.d.ts +17 -0
  13. package/dist/algorithms/analysis/connected-components.d.ts.map +1 -0
  14. package/dist/algorithms/analysis/cycle-detection.d.ts +19 -0
  15. package/dist/algorithms/analysis/cycle-detection.d.ts.map +1 -0
  16. package/dist/algorithms/analysis/index.d.ts +8 -0
  17. package/dist/algorithms/analysis/index.d.ts.map +1 -0
  18. package/dist/algorithms/analysis/scc.d.ts +18 -0
  19. package/dist/algorithms/analysis/scc.d.ts.map +1 -0
  20. package/dist/algorithms/analysis/topological-sort.d.ts +17 -0
  21. package/dist/algorithms/analysis/topological-sort.d.ts.map +1 -0
  22. package/dist/algorithms/clustering/index.d.ts +8 -0
  23. package/dist/algorithms/clustering/index.d.ts.map +1 -0
  24. package/dist/algorithms/clustering/infomap.d.ts +37 -0
  25. package/dist/algorithms/clustering/infomap.d.ts.map +1 -0
  26. package/dist/algorithms/clustering/label-propagation.d.ts +37 -0
  27. package/dist/algorithms/clustering/label-propagation.d.ts.map +1 -0
  28. package/dist/algorithms/clustering/leiden.d.ts +50 -0
  29. package/dist/algorithms/clustering/leiden.d.ts.map +1 -0
  30. package/dist/algorithms/clustering/louvain.d.ts +110 -0
  31. package/dist/algorithms/clustering/louvain.d.ts.map +1 -0
  32. package/dist/algorithms/decomposition/biconnected.d.ts +44 -0
  33. package/dist/algorithms/decomposition/biconnected.d.ts.map +1 -0
  34. package/dist/algorithms/decomposition/core-periphery.d.ts +37 -0
  35. package/dist/algorithms/decomposition/core-periphery.d.ts.map +1 -0
  36. package/dist/algorithms/decomposition/k-core.d.ts +32 -0
  37. package/dist/algorithms/decomposition/k-core.d.ts.map +1 -0
  38. package/dist/algorithms/extraction/ego-network.d.ts +89 -0
  39. package/dist/algorithms/extraction/ego-network.d.ts.map +1 -0
  40. package/dist/algorithms/extraction/ego-network.unit.test.d.ts +2 -0
  41. package/dist/algorithms/extraction/ego-network.unit.test.d.ts.map +1 -0
  42. package/dist/algorithms/extraction/filter.d.ts +32 -0
  43. package/dist/algorithms/extraction/filter.d.ts.map +1 -0
  44. package/dist/algorithms/extraction/motif.d.ts +171 -0
  45. package/dist/algorithms/extraction/motif.d.ts.map +1 -0
  46. package/dist/algorithms/extraction/path.d.ts +70 -0
  47. package/dist/algorithms/extraction/path.d.ts.map +1 -0
  48. package/dist/algorithms/extraction/subgraph.d.ts +34 -0
  49. package/dist/algorithms/extraction/subgraph.d.ts.map +1 -0
  50. package/dist/algorithms/extraction/truss.d.ts +59 -0
  51. package/dist/algorithms/extraction/truss.d.ts.map +1 -0
  52. package/dist/algorithms/extraction/validators.d.ts +59 -0
  53. package/dist/algorithms/extraction/validators.d.ts.map +1 -0
  54. package/dist/algorithms/graph/graph-adapter.d.ts +30 -0
  55. package/dist/algorithms/graph/graph-adapter.d.ts.map +1 -0
  56. package/dist/algorithms/graph/graph.d.ts +170 -0
  57. package/dist/algorithms/graph/graph.d.ts.map +1 -0
  58. package/dist/algorithms/graph/index.d.ts +5 -0
  59. package/dist/algorithms/graph/index.d.ts.map +1 -0
  60. package/dist/algorithms/hierarchical/clustering.d.ts +33 -0
  61. package/dist/algorithms/hierarchical/clustering.d.ts.map +1 -0
  62. package/dist/algorithms/index.d.ts +38 -0
  63. package/dist/algorithms/index.d.ts.map +1 -0
  64. package/dist/algorithms/layout/hierarchical-layout.d.ts +51 -0
  65. package/dist/algorithms/layout/hierarchical-layout.d.ts.map +1 -0
  66. package/dist/algorithms/metrics/cluster-quality.d.ts +114 -0
  67. package/dist/algorithms/metrics/cluster-quality.d.ts.map +1 -0
  68. package/dist/algorithms/metrics/conductance.d.ts +71 -0
  69. package/dist/algorithms/metrics/conductance.d.ts.map +1 -0
  70. package/dist/algorithms/metrics/index.d.ts +7 -0
  71. package/dist/algorithms/metrics/index.d.ts.map +1 -0
  72. package/dist/algorithms/metrics/modularity.d.ts +76 -0
  73. package/dist/algorithms/metrics/modularity.d.ts.map +1 -0
  74. package/dist/algorithms/partitioning/spectral.d.ts +38 -0
  75. package/dist/algorithms/partitioning/spectral.d.ts.map +1 -0
  76. package/dist/algorithms/pathfinding/dijkstra.d.ts +49 -0
  77. package/dist/algorithms/pathfinding/dijkstra.d.ts.map +1 -0
  78. package/dist/algorithms/pathfinding/mutual-information.d.ts +229 -0
  79. package/dist/algorithms/pathfinding/mutual-information.d.ts.map +1 -0
  80. package/dist/algorithms/pathfinding/path-ranking.d.ts +248 -0
  81. package/dist/algorithms/pathfinding/path-ranking.d.ts.map +1 -0
  82. package/dist/algorithms/pathfinding/priority-queue.d.ts +90 -0
  83. package/dist/algorithms/pathfinding/priority-queue.d.ts.map +1 -0
  84. package/dist/algorithms/traversal/bfs.d.ts +27 -0
  85. package/dist/algorithms/traversal/bfs.d.ts.map +1 -0
  86. package/dist/algorithms/traversal/bfs.unit.test.d.ts +2 -0
  87. package/dist/algorithms/traversal/bfs.unit.test.d.ts.map +1 -0
  88. package/dist/algorithms/traversal/bidirectional-bfs-fixtures.unit.test.d.ts +2 -0
  89. package/dist/algorithms/traversal/bidirectional-bfs-fixtures.unit.test.d.ts.map +1 -0
  90. package/dist/algorithms/traversal/bidirectional-bfs.d.ts +103 -0
  91. package/dist/algorithms/traversal/bidirectional-bfs.d.ts.map +1 -0
  92. package/dist/algorithms/traversal/degree-prioritised-expansion.d.ts +143 -0
  93. package/dist/algorithms/traversal/degree-prioritised-expansion.d.ts.map +1 -0
  94. package/dist/algorithms/traversal/dfs.d.ts +31 -0
  95. package/dist/algorithms/traversal/dfs.d.ts.map +1 -0
  96. package/dist/algorithms/traversal/dfs.unit.test.d.ts +2 -0
  97. package/dist/algorithms/traversal/dfs.unit.test.d.ts.map +1 -0
  98. package/dist/algorithms/traversal/index.d.ts +15 -0
  99. package/dist/algorithms/traversal/index.d.ts.map +1 -0
  100. package/dist/algorithms/traversal/priority-queue.d.ts +71 -0
  101. package/dist/algorithms/traversal/priority-queue.d.ts.map +1 -0
  102. package/dist/algorithms/types/algorithm-results.d.ts +111 -0
  103. package/dist/algorithms/types/algorithm-results.d.ts.map +1 -0
  104. package/dist/algorithms/types/clustering-types.d.ts +585 -0
  105. package/dist/algorithms/types/clustering-types.d.ts.map +1 -0
  106. package/dist/algorithms/types/errors.d.ts +106 -0
  107. package/dist/algorithms/types/errors.d.ts.map +1 -0
  108. package/dist/algorithms/types/graph.d.ts +144 -0
  109. package/dist/algorithms/types/graph.d.ts.map +1 -0
  110. package/dist/algorithms/types/index.d.ts +11 -0
  111. package/dist/algorithms/types/index.d.ts.map +1 -0
  112. package/dist/algorithms/types/option.d.ts +44 -0
  113. package/dist/algorithms/types/option.d.ts.map +1 -0
  114. package/dist/algorithms/types/result.d.ts +47 -0
  115. package/dist/algorithms/types/result.d.ts.map +1 -0
  116. package/dist/algorithms/types/weight-function.d.ts +34 -0
  117. package/dist/algorithms/types/weight-function.d.ts.map +1 -0
  118. package/dist/algorithms/utils/csr.d.ts +122 -0
  119. package/dist/algorithms/utils/csr.d.ts.map +1 -0
  120. package/dist/algorithms/utils/index.d.ts +7 -0
  121. package/dist/algorithms/utils/index.d.ts.map +1 -0
  122. package/dist/algorithms/utils/type-guards.d.ts +67 -0
  123. package/dist/algorithms/utils/type-guards.d.ts.map +1 -0
  124. package/dist/algorithms/utils/validators.d.ts +23 -0
  125. package/dist/algorithms/utils/validators.d.ts.map +1 -0
  126. package/dist/analyzer/advanced-props.d.ts +70 -0
  127. package/dist/analyzer/advanced-props.d.ts.map +1 -0
  128. package/dist/analyzer/advanced-structures.d.ts +162 -0
  129. package/dist/analyzer/advanced-structures.d.ts.map +1 -0
  130. package/dist/analyzer/analyzer-types.d.ts +49 -0
  131. package/dist/analyzer/analyzer-types.d.ts.map +1 -0
  132. package/dist/analyzer/connectivity.d.ts +21 -0
  133. package/dist/analyzer/connectivity.d.ts.map +1 -0
  134. package/dist/analyzer/core-props.d.ts +83 -0
  135. package/dist/analyzer/core-props.d.ts.map +1 -0
  136. package/dist/analyzer/helpers.d.ts +7 -0
  137. package/dist/analyzer/helpers.d.ts.map +1 -0
  138. package/dist/analyzer/index.d.ts +9 -0
  139. package/dist/analyzer/index.d.ts.map +1 -0
  140. package/dist/analyzer/main.d.ts +57 -0
  141. package/dist/analyzer/main.d.ts.map +1 -0
  142. package/dist/analyzer/path-props.d.ts +25 -0
  143. package/dist/analyzer/path-props.d.ts.map +1 -0
  144. package/dist/analyzer/predicates.d.ts +214 -0
  145. package/dist/analyzer/predicates.d.ts.map +1 -0
  146. package/dist/analyzer/spectral.d.ts +38 -0
  147. package/dist/analyzer/spectral.d.ts.map +1 -0
  148. package/dist/analyzer/structure.d.ts +19 -0
  149. package/dist/analyzer/structure.d.ts.map +1 -0
  150. package/dist/analyzer/types.d.ts +56 -0
  151. package/dist/analyzer/types.d.ts.map +1 -0
  152. package/dist/cli.js +49 -0
  153. package/dist/experiments/baselines/baselines.unit.test.d.ts +2 -0
  154. package/dist/experiments/baselines/baselines.unit.test.d.ts.map +1 -0
  155. package/dist/experiments/baselines/frontier-balanced.d.ts +122 -0
  156. package/dist/experiments/baselines/frontier-balanced.d.ts.map +1 -0
  157. package/dist/experiments/baselines/index.d.ts +12 -0
  158. package/dist/experiments/baselines/index.d.ts.map +1 -0
  159. package/dist/experiments/baselines/random-priority.d.ts +120 -0
  160. package/dist/experiments/baselines/random-priority.d.ts.map +1 -0
  161. package/dist/experiments/baselines/standard-bfs.d.ts +115 -0
  162. package/dist/experiments/baselines/standard-bfs.d.ts.map +1 -0
  163. package/dist/experiments/evaluation/__tests__/node-explosion.integration.test.d.ts +2 -0
  164. package/dist/experiments/evaluation/__tests__/node-explosion.integration.test.d.ts.map +1 -0
  165. package/dist/experiments/evaluation/__tests__/representativeness.integration.test.d.ts +2 -0
  166. package/dist/experiments/evaluation/__tests__/representativeness.integration.test.d.ts.map +1 -0
  167. package/dist/experiments/evaluation/baselines/degree-ranker.d.ts +14 -0
  168. package/dist/experiments/evaluation/baselines/degree-ranker.d.ts.map +1 -0
  169. package/dist/experiments/evaluation/baselines/index.d.ts +9 -0
  170. package/dist/experiments/evaluation/baselines/index.d.ts.map +1 -0
  171. package/dist/experiments/evaluation/baselines/pagerank-ranker.d.ts +15 -0
  172. package/dist/experiments/evaluation/baselines/pagerank-ranker.d.ts.map +1 -0
  173. package/dist/experiments/evaluation/baselines/random-ranker.d.ts +13 -0
  174. package/dist/experiments/evaluation/baselines/random-ranker.d.ts.map +1 -0
  175. package/dist/experiments/evaluation/baselines/shortest-path-ranker.d.ts +12 -0
  176. package/dist/experiments/evaluation/baselines/shortest-path-ranker.d.ts.map +1 -0
  177. package/dist/experiments/evaluation/baselines/weight-ranker.d.ts +14 -0
  178. package/dist/experiments/evaluation/baselines/weight-ranker.d.ts.map +1 -0
  179. package/dist/experiments/evaluation/fixtures/benchmark-datasets.d.ts +141 -0
  180. package/dist/experiments/evaluation/fixtures/benchmark-datasets.d.ts.map +1 -0
  181. package/dist/experiments/evaluation/fixtures/benchmark-datasets.unit.test.d.ts +9 -0
  182. package/dist/experiments/evaluation/fixtures/benchmark-datasets.unit.test.d.ts.map +1 -0
  183. package/dist/experiments/evaluation/fixtures/index.d.ts +7 -0
  184. package/dist/experiments/evaluation/fixtures/index.d.ts.map +1 -0
  185. package/dist/experiments/evaluation/ground-truth/between-graph.d.ts +74 -0
  186. package/dist/experiments/evaluation/ground-truth/between-graph.d.ts.map +1 -0
  187. package/dist/experiments/evaluation/ground-truth/between-graph.unit.test.d.ts +2 -0
  188. package/dist/experiments/evaluation/ground-truth/between-graph.unit.test.d.ts.map +1 -0
  189. package/dist/experiments/evaluation/ground-truth/importance-based.d.ts +80 -0
  190. package/dist/experiments/evaluation/ground-truth/importance-based.d.ts.map +1 -0
  191. package/dist/experiments/evaluation/ground-truth/index.d.ts +6 -0
  192. package/dist/experiments/evaluation/ground-truth/index.d.ts.map +1 -0
  193. package/dist/experiments/evaluation/index.d.ts +19 -0
  194. package/dist/experiments/evaluation/index.d.ts.map +1 -0
  195. package/dist/experiments/evaluation/ir-metrics.d.ts +58 -0
  196. package/dist/experiments/evaluation/ir-metrics.d.ts.map +1 -0
  197. package/dist/experiments/evaluation/loaders/edge-list-loader.d.ts +120 -0
  198. package/dist/experiments/evaluation/loaders/edge-list-loader.d.ts.map +1 -0
  199. package/dist/experiments/evaluation/loaders/index.d.ts +7 -0
  200. package/dist/experiments/evaluation/loaders/index.d.ts.map +1 -0
  201. package/dist/experiments/evaluation/metrics/degree-distribution.d.ts +95 -0
  202. package/dist/experiments/evaluation/metrics/degree-distribution.d.ts.map +1 -0
  203. package/dist/experiments/evaluation/metrics/degree-distribution.unit.test.d.ts +2 -0
  204. package/dist/experiments/evaluation/metrics/degree-distribution.unit.test.d.ts.map +1 -0
  205. package/dist/experiments/evaluation/metrics/index.d.ts +9 -0
  206. package/dist/experiments/evaluation/metrics/index.d.ts.map +1 -0
  207. package/dist/experiments/evaluation/metrics/path-diversity.d.ts +86 -0
  208. package/dist/experiments/evaluation/metrics/path-diversity.d.ts.map +1 -0
  209. package/dist/experiments/evaluation/metrics/path-diversity.unit.test.d.ts +2 -0
  210. package/dist/experiments/evaluation/metrics/path-diversity.unit.test.d.ts.map +1 -0
  211. package/dist/experiments/evaluation/metrics/structural-representativeness.d.ts +90 -0
  212. package/dist/experiments/evaluation/metrics/structural-representativeness.d.ts.map +1 -0
  213. package/dist/experiments/evaluation/metrics/structural-representativeness.unit.test.d.ts +2 -0
  214. package/dist/experiments/evaluation/metrics/structural-representativeness.unit.test.d.ts.map +1 -0
  215. package/dist/experiments/evaluation/path-planting/citation-planting.d.ts +33 -0
  216. package/dist/experiments/evaluation/path-planting/citation-planting.d.ts.map +1 -0
  217. package/dist/experiments/evaluation/path-planting/heterogeneous-planting.d.ts +39 -0
  218. package/dist/experiments/evaluation/path-planting/heterogeneous-planting.d.ts.map +1 -0
  219. package/dist/experiments/evaluation/path-planting/index.d.ts +10 -0
  220. package/dist/experiments/evaluation/path-planting/index.d.ts.map +1 -0
  221. package/dist/experiments/evaluation/path-planting/noise-generator.d.ts +20 -0
  222. package/dist/experiments/evaluation/path-planting/noise-generator.d.ts.map +1 -0
  223. package/dist/experiments/evaluation/path-planting/path-generator.d.ts +62 -0
  224. package/dist/experiments/evaluation/path-planting/path-generator.d.ts.map +1 -0
  225. package/dist/experiments/evaluation/rank-correlation.d.ts +22 -0
  226. package/dist/experiments/evaluation/rank-correlation.d.ts.map +1 -0
  227. package/dist/experiments/evaluation/runner/experiment-config.d.ts +92 -0
  228. package/dist/experiments/evaluation/runner/experiment-config.d.ts.map +1 -0
  229. package/dist/experiments/evaluation/runner/experiment-runner.d.ts +62 -0
  230. package/dist/experiments/evaluation/runner/experiment-runner.d.ts.map +1 -0
  231. package/dist/experiments/evaluation/runner/index.d.ts +7 -0
  232. package/dist/experiments/evaluation/runner/index.d.ts.map +1 -0
  233. package/dist/experiments/evaluation/runner/report-generator.d.ts +80 -0
  234. package/dist/experiments/evaluation/runner/report-generator.d.ts.map +1 -0
  235. package/dist/experiments/evaluation/statistics/bootstrap.d.ts +63 -0
  236. package/dist/experiments/evaluation/statistics/bootstrap.d.ts.map +1 -0
  237. package/dist/experiments/evaluation/statistics/effect-size.d.ts +115 -0
  238. package/dist/experiments/evaluation/statistics/effect-size.d.ts.map +1 -0
  239. package/dist/experiments/evaluation/statistics/index.d.ts +8 -0
  240. package/dist/experiments/evaluation/statistics/index.d.ts.map +1 -0
  241. package/dist/experiments/evaluation/statistics/multiple-comparison.d.ts +103 -0
  242. package/dist/experiments/evaluation/statistics/multiple-comparison.d.ts.map +1 -0
  243. package/dist/experiments/evaluation/statistics/paired-tests.d.ts +53 -0
  244. package/dist/experiments/evaluation/statistics/paired-tests.d.ts.map +1 -0
  245. package/dist/experiments/evaluation/types.d.ts +95 -0
  246. package/dist/experiments/evaluation/types.d.ts.map +1 -0
  247. package/dist/experiments/expansion-comparison.integration.test.d.ts +2 -0
  248. package/dist/experiments/expansion-comparison.integration.test.d.ts.map +1 -0
  249. package/dist/experiments/fixtures/mock-graph-expander.d.ts +31 -0
  250. package/dist/experiments/fixtures/mock-graph-expander.d.ts.map +1 -0
  251. package/dist/experiments/index.d.ts +12 -0
  252. package/dist/experiments/index.d.ts.map +1 -0
  253. package/dist/formats/gml/fetch.d.ts +58 -0
  254. package/dist/formats/gml/fetch.d.ts.map +1 -0
  255. package/dist/formats/gml/index.d.ts +26 -0
  256. package/dist/formats/gml/index.d.ts.map +1 -0
  257. package/dist/formats/gml/parse.d.ts +27 -0
  258. package/dist/formats/gml/parse.d.ts.map +1 -0
  259. package/dist/formats/gml/serialize.d.ts +21 -0
  260. package/dist/formats/gml/serialize.d.ts.map +1 -0
  261. package/dist/formats/gml/types.d.ts +126 -0
  262. package/dist/formats/gml/types.d.ts.map +1 -0
  263. package/dist/formats/index.d.ts +11 -0
  264. package/dist/formats/index.d.ts.map +1 -0
  265. package/dist/formats/pajek/fetch.d.ts +34 -0
  266. package/dist/formats/pajek/fetch.d.ts.map +1 -0
  267. package/dist/formats/pajek/index.d.ts +24 -0
  268. package/dist/formats/pajek/index.d.ts.map +1 -0
  269. package/dist/formats/pajek/parse.d.ts +28 -0
  270. package/dist/formats/pajek/parse.d.ts.map +1 -0
  271. package/dist/formats/pajek/types.d.ts +48 -0
  272. package/dist/formats/pajek/types.d.ts.map +1 -0
  273. package/dist/formats/snap/fetch.d.ts +32 -0
  274. package/dist/formats/snap/fetch.d.ts.map +1 -0
  275. package/dist/formats/snap/index.d.ts +24 -0
  276. package/dist/formats/snap/index.d.ts.map +1 -0
  277. package/dist/formats/snap/parse.d.ts +28 -0
  278. package/dist/formats/snap/parse.d.ts.map +1 -0
  279. package/dist/formats/snap/types.d.ts +22 -0
  280. package/dist/formats/snap/types.d.ts.map +1 -0
  281. package/dist/formats/ucinet/fetch.d.ts +34 -0
  282. package/dist/formats/ucinet/fetch.d.ts.map +1 -0
  283. package/dist/formats/ucinet/index.d.ts +24 -0
  284. package/dist/formats/ucinet/index.d.ts.map +1 -0
  285. package/dist/formats/ucinet/parse.d.ts +28 -0
  286. package/dist/formats/ucinet/parse.d.ts.map +1 -0
  287. package/dist/formats/ucinet/types.d.ts +51 -0
  288. package/dist/formats/ucinet/types.d.ts.map +1 -0
  289. package/dist/generation/constraints.d.ts +26 -0
  290. package/dist/generation/constraints.d.ts.map +1 -0
  291. package/dist/generation/generator.d.ts +44 -0
  292. package/dist/generation/generator.d.ts.map +1 -0
  293. package/dist/generation/generators/bipartite.d.ts +43 -0
  294. package/dist/generation/generators/bipartite.d.ts.map +1 -0
  295. package/dist/generation/generators/connectivity.d.ts +117 -0
  296. package/dist/generation/generators/connectivity.d.ts.map +1 -0
  297. package/dist/generation/generators/core-structures.d.ts +98 -0
  298. package/dist/generation/generators/core-structures.d.ts.map +1 -0
  299. package/dist/generation/generators/density-helpers.d.ts +37 -0
  300. package/dist/generation/generators/density-helpers.d.ts.map +1 -0
  301. package/dist/generation/generators/edge-generator.d.ts +25 -0
  302. package/dist/generation/generators/edge-generator.d.ts.map +1 -0
  303. package/dist/generation/generators/geometric.d.ts +40 -0
  304. package/dist/generation/generators/geometric.d.ts.map +1 -0
  305. package/dist/generation/generators/invariants.d.ts +43 -0
  306. package/dist/generation/generators/invariants.d.ts.map +1 -0
  307. package/dist/generation/generators/network-structures.d.ts +30 -0
  308. package/dist/generation/generators/network-structures.d.ts.map +1 -0
  309. package/dist/generation/generators/node-generator.d.ts +12 -0
  310. package/dist/generation/generators/node-generator.d.ts.map +1 -0
  311. package/dist/generation/generators/path-cycle.d.ts +61 -0
  312. package/dist/generation/generators/path-cycle.d.ts.map +1 -0
  313. package/dist/generation/generators/property-computers.d.ts +103 -0
  314. package/dist/generation/generators/property-computers.d.ts.map +1 -0
  315. package/dist/generation/generators/spectral.d.ts +32 -0
  316. package/dist/generation/generators/spectral.d.ts.map +1 -0
  317. package/dist/generation/generators/structural-classes.d.ts +93 -0
  318. package/dist/generation/generators/structural-classes.d.ts.map +1 -0
  319. package/dist/generation/generators/structure-handlers.d.ts +17 -0
  320. package/dist/generation/generators/structure-handlers.d.ts.map +1 -0
  321. package/dist/generation/generators/symmetry.d.ts +72 -0
  322. package/dist/generation/generators/symmetry.d.ts.map +1 -0
  323. package/dist/generation/generators/types.d.ts +63 -0
  324. package/dist/generation/generators/types.d.ts.map +1 -0
  325. package/dist/generation/generators/validation-helpers.d.ts +51 -0
  326. package/dist/generation/generators/validation-helpers.d.ts.map +1 -0
  327. package/dist/generation/graph-validator.d.ts +8 -0
  328. package/dist/generation/graph-validator.d.ts.map +1 -0
  329. package/dist/generation/index.d.ts +11 -0
  330. package/dist/generation/index.d.ts.map +1 -0
  331. package/dist/generation/spec/advanced.d.ts +171 -0
  332. package/dist/generation/spec/advanced.d.ts.map +1 -0
  333. package/dist/generation/spec/core.d.ts +64 -0
  334. package/dist/generation/spec/core.d.ts.map +1 -0
  335. package/dist/generation/spec/geometric.d.ts +24 -0
  336. package/dist/generation/spec/geometric.d.ts.map +1 -0
  337. package/dist/generation/spec/index.d.ts +21 -0
  338. package/dist/generation/spec/index.d.ts.map +1 -0
  339. package/dist/generation/spec/invariants.d.ts +55 -0
  340. package/dist/generation/spec/invariants.d.ts.map +1 -0
  341. package/dist/generation/spec/metrics.d.ts +34 -0
  342. package/dist/generation/spec/metrics.d.ts.map +1 -0
  343. package/dist/generation/spec/network.d.ts +34 -0
  344. package/dist/generation/spec/network.d.ts.map +1 -0
  345. package/dist/generation/spec/path-cycle.d.ts +22 -0
  346. package/dist/generation/spec/path-cycle.d.ts.map +1 -0
  347. package/dist/generation/spec/products.d.ts +288 -0
  348. package/dist/generation/spec/products.d.ts.map +1 -0
  349. package/dist/generation/spec/regularity.d.ts +34 -0
  350. package/dist/generation/spec/regularity.d.ts.map +1 -0
  351. package/dist/generation/spec/structural.d.ts +54 -0
  352. package/dist/generation/spec/structural.d.ts.map +1 -0
  353. package/dist/generation/spec/symmetry.d.ts +38 -0
  354. package/dist/generation/spec/symmetry.d.ts.map +1 -0
  355. package/dist/generation/spec/test.d.ts +43 -0
  356. package/dist/generation/spec/test.d.ts.map +1 -0
  357. package/dist/generation/spec.d.ts +264 -0
  358. package/dist/generation/spec.d.ts.map +1 -0
  359. package/dist/index.cjs +48 -0
  360. package/dist/index.d.ts +114 -0
  361. package/dist/index.d.ts.map +1 -0
  362. package/dist/index.js +13033 -0
  363. package/dist/index.umd.js +48 -0
  364. package/dist/interfaces/graph-expander.d.ts +80 -0
  365. package/dist/interfaces/graph-expander.d.ts.map +1 -0
  366. package/dist/interfaces/readable-graph.d.ts +80 -0
  367. package/dist/interfaces/readable-graph.d.ts.map +1 -0
  368. package/dist/utils/wayback.d.ts +118 -0
  369. package/dist/utils/wayback.d.ts.map +1 -0
  370. package/dist/validation/basic-validators.d.ts +78 -0
  371. package/dist/validation/basic-validators.d.ts.map +1 -0
  372. package/dist/validation/coloring-validator.d.ts +35 -0
  373. package/dist/validation/coloring-validator.d.ts.map +1 -0
  374. package/dist/validation/connectivity-validators.d.ts +38 -0
  375. package/dist/validation/connectivity-validators.d.ts.map +1 -0
  376. package/dist/validation/degree-validators.d.ts +28 -0
  377. package/dist/validation/degree-validators.d.ts.map +1 -0
  378. package/dist/validation/density-connectivity.d.ts +41 -0
  379. package/dist/validation/density-connectivity.d.ts.map +1 -0
  380. package/dist/validation/extremal.d.ts +24 -0
  381. package/dist/validation/extremal.d.ts.map +1 -0
  382. package/dist/validation/flow-validator.d.ts +17 -0
  383. package/dist/validation/flow-validator.d.ts.map +1 -0
  384. package/dist/validation/geometric.d.ts +15 -0
  385. package/dist/validation/geometric.d.ts.map +1 -0
  386. package/dist/validation/helper-functions.d.ts +85 -0
  387. package/dist/validation/helper-functions.d.ts.map +1 -0
  388. package/dist/validation/index.d.ts +26 -0
  389. package/dist/validation/index.d.ts.map +1 -0
  390. package/dist/validation/index.unit.test.d.ts +5 -0
  391. package/dist/validation/index.unit.test.d.ts.map +1 -0
  392. package/dist/validation/invariant.d.ts +28 -0
  393. package/dist/validation/invariant.d.ts.map +1 -0
  394. package/dist/validation/minor.d.ts +17 -0
  395. package/dist/validation/minor.d.ts.map +1 -0
  396. package/dist/validation/network.d.ts +21 -0
  397. package/dist/validation/network.d.ts.map +1 -0
  398. package/dist/validation/path-cycle.d.ts +39 -0
  399. package/dist/validation/path-cycle.d.ts.map +1 -0
  400. package/dist/validation/product.d.ts +31 -0
  401. package/dist/validation/product.d.ts.map +1 -0
  402. package/dist/validation/robustness.d.ts +17 -0
  403. package/dist/validation/robustness.d.ts.map +1 -0
  404. package/dist/validation/spectral.d.ts +23 -0
  405. package/dist/validation/spectral.d.ts.map +1 -0
  406. package/dist/validation/structural-class.d.ts +57 -0
  407. package/dist/validation/structural-class.d.ts.map +1 -0
  408. package/dist/validation/structural.d.ts +41 -0
  409. package/dist/validation/structural.d.ts.map +1 -0
  410. package/dist/validation/symmetry.d.ts +45 -0
  411. package/dist/validation/symmetry.d.ts.map +1 -0
  412. package/dist/validation/treewidth-validator.d.ts +35 -0
  413. package/dist/validation/treewidth-validator.d.ts.map +1 -0
  414. package/dist/validation/types.d.ts +20 -0
  415. package/dist/validation/types.d.ts.map +1 -0
  416. package/package.json +91 -7
package/README.md ADDED
@@ -0,0 +1,191 @@
1
+ # GraphBox
2
+
3
+ **GraphBox** = Graph Sandbox + Graph Toolbox
4
+
5
+ Abstract and experimental graph algorithms for academic research. The name reflects its dual purpose:
6
+
7
+ - **Sandbox** — A space for experimenting with graph algorithms, data structures, and traversal strategies
8
+ - **Toolbox** — A collection of reusable, well-tested graph utilities for production use
9
+
10
+ GraphBox provides a toolkit for graph manipulation, analysis, and generation, specifically designed for academic research in graph theory, network science, and citation analysis.
11
+
12
+ ## Overview
13
+
14
+ Graph-Box consolidates three previously separate BibGraph packages into a single, focused package:
15
+
16
+ - **graph-core**: Core graph interfaces and adapters
17
+ - **graph-expansion**: Graph expansion, traversal algorithms, and neighborhood exploration
18
+ - **graph-gen**: Graph specification, generation, and validation system
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ pnpm install graph-box
24
+ ```
25
+
26
+ ## Key Features
27
+
28
+ ### Graph Adapters
29
+
30
+ `GraphAdapter` provides a bridge between different graph implementations, allowing you to use generic algorithms with your specific graph data structures.
31
+
32
+ ```typescript
33
+ import { GraphAdapter } from 'graph-box';
34
+
35
+ const adapter = new GraphAdapter(graph);
36
+ ```
37
+
38
+ ### Graph Traversal
39
+
40
+ Multiple traversal algorithms for exploring graph neighborhoods:
41
+
42
+ - **BFS** - Breadth-first search
43
+ - **DFS** - Depth-first search
44
+ - **Bidirectional BFS** - Optimized bidirectional search
45
+ - **Degree-Prioritized** - Expansion based on node degree
46
+ - **Priority Queue** - Custom priority-based expansion
47
+
48
+ ```typescript
49
+ import { bfs, dfs, extractEgoNetwork } from 'graph-box';
50
+
51
+ const bfsResult = bfs(adapter, 'startNodeId');
52
+ const dfsResult = dfs(adapter, 'startNodeId');
53
+ ```
54
+
55
+ ### Graph Extraction
56
+
57
+ Extract ego networks and multi-source neighborhoods:
58
+
59
+ ```typescript
60
+ const egoNetwork = extractEgoNetwork(adapter, {
61
+ radius: 2,
62
+ seedNodes: ['nodeId'],
63
+ });
64
+ ```
65
+
66
+ ### Graph Generation
67
+
68
+ Type-safe graph generation with mathematical constraint validation:
69
+
70
+ ```typescript
71
+ import { generateGraph, validateGraph } from 'graph-box';
72
+
73
+ const spec = {
74
+ type: 'complete',
75
+ nodeCount: 100,
76
+ edgeDensity: 0.1,
77
+ constraints: {
78
+ minDegree: 2,
79
+ maxDegree: 10,
80
+ connected: true
81
+ }
82
+ };
83
+
84
+ const graph = generateGraph(spec);
85
+ const valid = validateGraph(graph, spec.constraints);
86
+ ```
87
+
88
+ ### Graph Validation
89
+
90
+ Mathematical constraint validation for graph properties:
91
+
92
+ ```typescript
93
+ import { validateGraph, checkConstraints } from 'graph-box';
94
+
95
+ const isValid = validateGraph(graph, constraints);
96
+ ```
97
+
98
+ ## Usage Examples
99
+
100
+ ### Basic Traversal
101
+
102
+ ```typescript
103
+ import { GraphAdapter, bfs } from 'graph-box';
104
+
105
+ const graph = { /* your graph */ };
106
+ const adapter = new GraphAdapter(graph);
107
+
108
+ const result = bfs(adapter, 'startNodeId');
109
+ console.log(result.visited); // Array of visited node IDs
110
+ ```
111
+
112
+ ### Ego Network Extraction
113
+
114
+ ```typescript
115
+ import { extractEgoNetwork } from 'graph-box';
116
+
117
+ const adapter = new GraphAdapter(graph);
118
+
119
+ const egoNetwork = extractEgoNetwork(adapter, {
120
+ radius: 2,
121
+ seedNodes: ['author123'],
122
+ includeEdgeWeights: true
123
+ });
124
+
125
+ console.log(egoNetwork);
126
+ ```
127
+
128
+ ### Graph Generation
129
+
130
+ ```typescript
131
+ import { generateGraph, GraphSpec } from 'graph-box';
132
+
133
+ const spec: GraphSpec = {
134
+ type: 'complete',
135
+ nodeCount: 50,
136
+ edgeDensity: 0.15
137
+ };
138
+
139
+ const graph = generateGraph(spec);
140
+ ```
141
+
142
+ ### Graph Validation
143
+
144
+ ```typescript
145
+ import { validateGraph } from 'graph-box';
146
+
147
+ const graph = { /* graph object */ };
148
+ const isValid = validateGraph(graph);
149
+ ```
150
+
151
+ ## API Reference
152
+
153
+ ### Core Classes
154
+
155
+ - **GraphAdapter** - Adapter pattern for graph abstraction
156
+ - **GraphExpander** - Interface for dynamic graph expansion
157
+ - **PriorityQueue** - Priority queue for degree-based expansion
158
+
159
+ ### Traversal Algorithms
160
+
161
+ - **bfs(adapter, startNodeId, options?)** - Breadth-first search
162
+ - **dfs(adapter, startNodeId, options?)** - Depth-first search
163
+ - **BidirectionalBFS** - Bidirectional BFS search
164
+
165
+ ### Extraction Methods
166
+
167
+ - **extractEgoNetwork(adapter, options)** - Extract ego-centered subgraph
168
+ - **extractMultiSourceEgoNetwork(adapter, options)** - Multi-source extraction
169
+
170
+ ### Generation Functions
171
+
172
+ - **generateGraph(spec)** - Generate graph from specification
173
+ - **validateGraph(graph, constraints)** - Validate graph against constraints
174
+
175
+ ## Contributing
176
+
177
+ This package is part of academic research work. Contributions are welcome, please open an issue first.
178
+
179
+ ## License
180
+
181
+ MIT
182
+
183
+ ## Author
184
+
185
+ Joe Mearman
186
+
187
+ ## Related Projects
188
+
189
+ - **BibGraph**: Main BibGraph monorepo
190
+ - **algorithms**: Graph algorithms package for BibGraph
191
+ - **types**: Shared TypeScript types for BibGraph
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=analyzer.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyzer.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/analyzer.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Unit tests for graph spec constraints analyzer
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=constraints.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constraints.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/constraints.unit.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Unit tests for graph generator
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=generator.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/generator.unit.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=graph-properties.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-properties.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/graph-properties.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Unit tests for graph validator
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=graph-validator.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-validator.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/graph-validator.unit.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,17 @@
1
+ import { Graph } from '../graph/graph';
2
+ import { Component } from '../types/algorithm-results';
3
+ import { InvalidInputError } from '../types/errors';
4
+ import { Edge, Node } from '../types/graph';
5
+ import { Result } from '../types/result';
6
+ /**
7
+ * Find all connected components in an undirected graph (or weakly connected components in directed graph).
8
+ *
9
+ * Uses DFS to traverse each component. For directed graphs, treats edges as undirected.
10
+ *
11
+ * Time Complexity: O(V + E)
12
+ * Space Complexity: O(V)
13
+ * @param graph - The graph to analyze
14
+ * @returns Result containing array of components
15
+ */
16
+ export declare const connectedComponents: <N extends Node, E extends Edge = Edge>(graph: Graph<N, E>) => Result<Component<N>[], InvalidInputError>;
17
+ //# sourceMappingURL=connected-components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connected-components.d.ts","sourceRoot":"","sources":["../../../src/algorithms/analysis/connected-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,EAAC,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAoB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEhE;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,IAAI,GAAG,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,iBAAiB,CAyDvI,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { Graph } from '../graph/graph';
2
+ import { CycleInfo } from '../types/algorithm-results';
3
+ import { InvalidInputError } from '../types/errors';
4
+ import { Edge, Node } from '../types/graph';
5
+ import { Option } from '../types/option';
6
+ import { Result } from '../types/result';
7
+ /**
8
+ * Detect cycles in a graph using DFS.
9
+ *
10
+ * For directed graphs: detects back edges (edges to ancestors in DFS tree)
11
+ * For undirected graphs: detects any edge except parent edge
12
+ *
13
+ * Time Complexity: O(V + E)
14
+ * Space Complexity: O(V)
15
+ * @param graph - The graph to check for cycles
16
+ * @returns Result containing Option with cycle info if found
17
+ */
18
+ export declare const detectCycle: <N extends Node, E extends Edge>(graph: Graph<N, E>) => Result<Option<CycleInfo<N, E>>, InvalidInputError>;
19
+ //# sourceMappingURL=cycle-detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cycle-detection.d.ts","sourceRoot":"","sources":["../../../src/algorithms/analysis/cycle-detection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,EAAC,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAO,KAAK,MAAM,EAAQ,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAoB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAwHjI,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file Automatically generated by barrelsby.
3
+ */
4
+ export * from './connected-components';
5
+ export * from './cycle-detection';
6
+ export * from './scc';
7
+ export * from './topological-sort';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/analysis/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Graph } from '../graph/graph';
2
+ import { Component } from '../types/algorithm-results';
3
+ import { InvalidInputError } from '../types/errors';
4
+ import { Edge, Node } from '../types/graph';
5
+ import { Result } from '../types/result';
6
+ /**
7
+ * Find all strongly connected components using Tarjan's algorithm.
8
+ *
9
+ * A strongly connected component (SCC) is a maximal set of vertices where
10
+ * every vertex is reachable from every other vertex in the set.
11
+ *
12
+ * Time Complexity: O(V + E)
13
+ * Space Complexity: O(V)
14
+ * @param graph - The directed graph to analyze
15
+ * @returns Result containing array of SCCs
16
+ */
17
+ export declare const stronglyConnectedComponents: <N extends Node, E extends Edge = Edge>(graph: Graph<N, E>) => Result<Component<N>[], InvalidInputError>;
18
+ //# sourceMappingURL=scc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scc.d.ts","sourceRoot":"","sources":["../../../src/algorithms/analysis/scc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,EAAC,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAoB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,GAAI,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,IAAI,GAAG,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,iBAAiB,CAiF/I,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Graph } from '../graph/graph';
2
+ import { CycleDetectedError, InvalidInputError } from '../types/errors';
3
+ import { Edge, Node } from '../types/graph';
4
+ import { Result } from '../types/result';
5
+ /**
6
+ * Topological sort using DFS-based reverse postorder.
7
+ *
8
+ * Returns a linear ordering of vertices such that for every directed edge (u, v),
9
+ * u comes before v in the ordering. Only works on Directed Acyclic Graphs (DAGs).
10
+ *
11
+ * Time Complexity: O(V + E)
12
+ * Space Complexity: O(V)
13
+ * @param graph - The directed graph to sort
14
+ * @returns Result containing ordered nodes or cycle error
15
+ */
16
+ export declare const topologicalSort: <N extends Node, E extends Edge = Edge>(graph: Graph<N, E>) => Result<N[], CycleDetectedError | InvalidInputError>;
17
+ //# sourceMappingURL=topological-sort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topological-sort.d.ts","sourceRoot":"","sources":["../../../src/algorithms/analysis/topological-sort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,KAAK,IAAI,EAAC,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAoB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,IAAI,GAAG,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,EAAE,EAAE,kBAAkB,GAAG,iBAAiB,CAmF7I,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file Automatically generated by barrelsby.
3
+ */
4
+ export * from './infomap';
5
+ export * from './label-propagation';
6
+ export * from './leiden';
7
+ export * from './louvain';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/clustering/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { Graph } from '../graph/graph';
2
+ import { InfomapResult } from '../types/clustering-types';
3
+ import { Edge, Node } from '../types/graph';
4
+ import { WeightFunction } from '../types/weight-function';
5
+ /**
6
+ * Detect communities using the Infomap algorithm.
7
+ *
8
+ * Infomap uses information theory to find communities by minimizing the
9
+ * description length (map equation) of random walks on the network.
10
+ * @template N - Node type
11
+ * @template E - Edge type
12
+ * @param graph - Input graph (directed or undirected)
13
+ * @param options - Optional configuration
14
+ * @param options.weightFn - Weight function for edges (default: all edges weight 1.0)
15
+ * @param options.maxIterations - Maximum iterations for optimization (default: 100)
16
+ * @param options.numTrials - Number of random trials for greedy search (default: 10)
17
+ * @param options.seed - Random seed for reproducibility (default: undefined)
18
+ * @returns Result containing modules with compression ratio
19
+ * @example
20
+ * ```typescript
21
+ * const graph = new Graph<PaperNode, CitationEdge>(true);
22
+ * // ... add nodes and edges ...
23
+ *
24
+ * const result = infomap(graph);
25
+ * if (result.ok) {
26
+ * console.log(`Found ${result.value.modules.length} modules`);
27
+ * console.log(`Compression ratio: ${result.value.compressionRatio}`);
28
+ * }
29
+ * ```
30
+ */
31
+ export declare const infomap: <N extends Node, E extends Edge>(graph: Graph<N, E>, options?: {
32
+ weightFn?: WeightFunction<N, E>;
33
+ maxIterations?: number;
34
+ numTrials?: number;
35
+ seed?: number;
36
+ }) => InfomapResult<N>;
37
+ //# sourceMappingURL=infomap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infomap.d.ts","sourceRoot":"","sources":["../../../src/algorithms/clustering/infomap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAAE,IAAI,EAAC,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAqB/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,UAAS;IACpF,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACT,KAAG,aAAa,CAAC,CAAC,CAmOvB,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { Graph } from '../graph/graph';
2
+ import { LabelPropagationResult } from '../types/clustering-types';
3
+ import { Edge, Node } from '../types/graph';
4
+ import { WeightFunction } from '../types/weight-function';
5
+ /**
6
+ * Label Propagation clustering algorithm.
7
+ *
8
+ * Fast semi-supervised clustering algorithm that propagates labels through
9
+ * the network based on neighbor voting. Nodes iteratively adopt the most
10
+ * frequent label among their neighbors.
11
+ * @template N - Node type
12
+ * @template E - Edge type
13
+ * @param graph - Input graph (directed or undirected)
14
+ * @param options - Optional configuration
15
+ * @param options.weightFn - Weight function for edges (default: all edges weight 1.0)
16
+ * @param options.maxIterations - Maximum iterations (default: 100)
17
+ * @param options.seed - Random seed for reproducibility (default: Date.now())
18
+ * @returns Result containing clusters or error
19
+ * @example
20
+ * ```typescript
21
+ * const graph = new Graph<PaperNode, CitationEdge>(true);
22
+ * // ... add nodes and edges ...
23
+ *
24
+ * const result = labelPropagation(graph);
25
+ * if (result.ok) {
26
+ * console.log(`Found ${result.value.clusters.length} clusters`);
27
+ * console.log(`Converged: ${result.value.metadata.converged}`);
28
+ * console.log(`Iterations: ${result.value.metadata.iterations}`);
29
+ * }
30
+ * ```
31
+ */
32
+ export declare const labelPropagation: <N extends Node, E extends Edge>(graph: Graph<N, E>, options?: {
33
+ weightFn?: WeightFunction<N, E>;
34
+ maxIterations?: number;
35
+ seed?: number;
36
+ }) => LabelPropagationResult<N>;
37
+ //# sourceMappingURL=label-propagation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label-propagation.d.ts","sourceRoot":"","sources":["../../../src/algorithms/clustering/label-propagation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAIX,sBAAsB,EACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,EAAC,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,UAAS;IAC7F,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACT,KAAG,sBAAsB,CAAC,CAAC,CA+MhC,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { Graph } from '../graph/graph';
2
+ import { ClusteringError, ClusterMetrics, LeidenCommunity } from '../types/clustering-types';
3
+ import { Edge, Node } from '../types/graph';
4
+ import { Result } from '../types/result';
5
+ import { WeightFunction } from '../types/weight-function';
6
+ /**
7
+ * Detect communities using the Leiden algorithm.
8
+ *
9
+ * The Leiden algorithm improves upon Louvain by adding a refinement phase that
10
+ * guarantees all detected communities are connected subgraphs.
11
+ * @template N - Node type
12
+ * @template E - Edge type
13
+ * @param graph - Input graph (directed or undirected)
14
+ * @param options - Optional configuration
15
+ * @param options.weightFn - Weight function for edges (default: all edges weight 1.0)
16
+ * @param options.resolution - Resolution parameter (default: 1.0, higher values favor more communities)
17
+ * @param options.maxIterations - Maximum iterations per phase (default: 100)
18
+ * @returns Result with array of detected Leiden communities
19
+ * @example
20
+ * ```typescript
21
+ * const graph = new Graph<PaperNode, CitationEdge>(true);
22
+ * // ... add nodes and edges ...
23
+ *
24
+ * const result = leiden(graph);
25
+ * if (result.ok) {
26
+ * console.log(`Found ${result.value.communities.length} communities`);
27
+ * result.value.communities.forEach((community) => {
28
+ * console.log(`Community ${community.id}: ${community.nodes.size} nodes, connected: ${community.isConnected}`);
29
+ * });
30
+ * }
31
+ * ```
32
+ */
33
+ export declare const leiden: <N extends Node, E extends Edge>(graph: Graph<N, E>, options?: {
34
+ weightFn?: WeightFunction<N, E>;
35
+ resolution?: number;
36
+ maxIterations?: number;
37
+ }) => Result<{
38
+ communities: LeidenCommunity<N>[];
39
+ metrics: ClusterMetrics;
40
+ metadata: {
41
+ algorithm: "leiden";
42
+ runtime: number;
43
+ iterations: number;
44
+ parameters: {
45
+ resolution?: number;
46
+ maxIterations?: number;
47
+ };
48
+ };
49
+ }, ClusteringError>;
50
+ //# sourceMappingURL=leiden.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leiden.d.ts","sourceRoot":"","sources":["../../../src/algorithms/clustering/leiden.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAI5C,OAAO,KAAK,EAAE,eAAe,EAAC,cAAc,EAAa,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5G,OAAO,KAAK,EAAE,IAAI,EAAC,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAY/D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,UAAS;IACnF,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,MAAM,CACd;IACC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IAClC,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE;QACT,SAAS,EAAE,QAAQ,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE;YACX,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,aAAa,CAAC,EAAE,MAAM,CAAC;SACvB,CAAC;KACF,CAAC;CACF,EACD,eAAe,CA+Rf,CAAC"}
@@ -0,0 +1,110 @@
1
+ import { Graph } from '../graph/graph';
2
+ import { Community } from '../types/clustering-types';
3
+ import { Edge, Node } from '../types/graph';
4
+ import { WeightFunction } from '../types/weight-function';
5
+ /**
6
+ * Get adaptive convergence threshold based on graph size.
7
+ * @param nodeCount - Number of nodes in graph
8
+ * @returns Convergence threshold (1e-5 for large graphs, 1e-6 for small graphs)
9
+ * @remarks
10
+ * Large graphs (>500 nodes) use looser threshold for faster convergence.
11
+ * Small graphs (≤500 nodes) use stricter threshold for higher quality.
12
+ */
13
+ export declare const getAdaptiveThreshold: (nodeCount: number) => number;
14
+ /**
15
+ * Get adaptive iteration limit based on graph size and hierarchy level.
16
+ * @param nodeCount - Number of nodes in graph
17
+ * @param level - Hierarchy level (0 = first level)
18
+ * @returns Maximum iterations (20, 40, or 50)
19
+ * @remarks
20
+ * First hierarchy level (level 0) with large graphs (>200 nodes) uses lower limit (20)
21
+ * because most node movements happen in the first iteration.
22
+ * Subsequent levels and small graphs use higher limits (40-50) for refinement.
23
+ */
24
+ export declare const getAdaptiveIterationLimit: (nodeCount: number, level: number) => number;
25
+ /**
26
+ * Determine optimal neighbor selection mode based on graph size.
27
+ * @param nodeCount - Number of nodes in graph
28
+ * @returns Neighbor selection mode ("best" or "random")
29
+ * @remarks
30
+ * **UPDATE (Phase 4 debugging)**: Random mode disabled for citation networks.
31
+ *
32
+ * Testing revealed Fast Louvain random-neighbor selection causes severe quality degradation
33
+ * for citation network graphs (Q=0.05-0.12 vs Q=0.37 with best mode), failing the minimum
34
+ * quality threshold of Q≥0.19. Random mode also paradoxically SLOWED convergence (201 iterations
35
+ * vs 103 with best mode), resulting in 3x slower runtime.
36
+ *
37
+ * Root cause: Citation networks have different structural properties than the social/web networks
38
+ * where Fast Louvain was benchmarked in literature. Accepting first positive ΔQ leads to poor-quality
39
+ * moves that require many iterations to correct.
40
+ *
41
+ * **Current strategy**: Always use best-neighbor mode for quality. Random mode remains available
42
+ * via explicit `mode: "random"` parameter for experimentation but is not recommended.
43
+ */
44
+ export declare const determineOptimalMode: () => "best" | "random";
45
+ /**
46
+ * Shuffle an array in-place using Fisher-Yates algorithm.
47
+ * @param array - Array to shuffle (modified in-place)
48
+ * @param seed - Optional random seed for deterministic shuffling (for tests)
49
+ * @returns The shuffled array (same reference as input)
50
+ * @remarks
51
+ * Fisher-Yates shuffle guarantees uniform distribution of permutations.
52
+ * If seed is provided, uses simple linear congruential generator (LCG) for PRNG.
53
+ * If seed is undefined, uses Math.random() (non-deterministic).
54
+ *
55
+ * LCG parameters: a=1664525, c=1013904223, m=2^32 (Numerical Recipes)
56
+ */
57
+ export declare const shuffle: <T>(array: T[], seed?: number) => T[];
58
+ /**
59
+ * Detect communities using the Louvain algorithm.
60
+ *
61
+ * The Louvain method is a greedy optimization method that attempts to optimize
62
+ * the modularity of a partition of the network.
63
+ * @template N - Node type
64
+ * @template E - Edge type
65
+ * @param graph - Input graph (directed or undirected)
66
+ * @param options - Optional configuration (combines legacy and optimization parameters)
67
+ * @param options.weightFn - Weight function for edges (default: all edges weight 1.0) [Legacy]
68
+ * @param options.resolution - Resolution parameter (default: 1.0, higher values favor more communities) [Legacy]
69
+ * @param options.mode - Neighbor selection strategy ("auto", "best", "random") [spec-027 Phase 2]
70
+ * @param options.seed - Random seed for deterministic shuffling [spec-027 Phase 2]
71
+ * @param options.minModularityIncrease - Minimum modularity improvement to continue (adaptive default via getAdaptiveThreshold)
72
+ * @param options.maxIterations - Maximum iterations per phase (adaptive default via getAdaptiveIterationLimit)
73
+ * @returns Array of detected communities
74
+ * @remarks
75
+ * **Adaptive Defaults** (spec-027 Phase 1):
76
+ * - `minModularityIncrease`: 1e-5 for >500 nodes, 1e-6 otherwise
77
+ * - `maxIterations`: 20 for >200 nodes (level 0), 40-50 otherwise
78
+ *
79
+ * **Neighbor Selection Modes** (spec-027 Phase 2):
80
+ * - `"auto"`: Best-neighbor for <200 nodes, random for ≥500 nodes
81
+ * - `"best"`: Always use best-neighbor (quality-first)
82
+ * - `"random"`: Always use random-neighbor (speed-first, Fast Louvain)
83
+ * @example
84
+ * ```typescript
85
+ * const graph = new Graph<PaperNode, CitationEdge>(true);
86
+ * // ... add nodes and edges ...
87
+ *
88
+ * // Basic usage (adaptive defaults)
89
+ * const communities = detectCommunities(graph);
90
+ * console.log(`Found ${communities.length} communities`);
91
+ *
92
+ * // Quality-first mode
93
+ * const qualityCommunities = detectCommunities(graph, { mode: "best" });
94
+ *
95
+ * // Speed-first mode for large graphs
96
+ * const fastCommunities = detectCommunities(graph, { mode: "random", maxIterations: 10 });
97
+ *
98
+ * // Reproducible results
99
+ * const deterministicCommunities = detectCommunities(graph, { seed: 42 });
100
+ * ```
101
+ */
102
+ export declare const detectCommunities: <N extends Node, E extends Edge>(graph: Graph<N, E>, options?: {
103
+ weightFn?: WeightFunction<N, E>;
104
+ resolution?: number;
105
+ mode?: "auto" | "best" | "random";
106
+ seed?: number;
107
+ minModularityIncrease?: number;
108
+ maxIterations?: number;
109
+ }) => Community<N>[];
110
+ //# sourceMappingURL=louvain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"louvain.d.ts","sourceRoot":"","sources":["../../../src/algorithms/clustering/louvain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAC,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAa/D;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,WAAW,MAAM,KAAG,MAAuC,CAAC;AAEjG;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,GAAI,WAAW,MAAM,EAAE,OAAO,MAAM,KAAG,MAK5E,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,QAAO,MAAM,GAAG,QAAkB,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO,MAAM,KAAG,CAAC,EAsBvD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,UAAS;IAC9F,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,SAAS,CAAC,CAAC,CAAC,EAwXpB,CAAC"}