@graphty/graph-samples 0.0.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +123 -0
  3. package/README.md +190 -1
  4. package/dist/chunks/build-DdCe60t3.js +47 -0
  5. package/dist/chunks/build-DdCe60t3.js.map +1 -0
  6. package/dist/chunks/meta-B6toBzaa.js +19 -0
  7. package/dist/chunks/meta-B6toBzaa.js.map +1 -0
  8. package/dist/chunks/meta-BM_YIhlA.js +28 -0
  9. package/dist/chunks/meta-BM_YIhlA.js.map +1 -0
  10. package/dist/chunks/meta-BMmtUpPx.js +30 -0
  11. package/dist/chunks/meta-BMmtUpPx.js.map +1 -0
  12. package/dist/chunks/meta-BXC7oi86.js +22 -0
  13. package/dist/chunks/meta-BXC7oi86.js.map +1 -0
  14. package/dist/chunks/meta-BaFPvhc1.js +19 -0
  15. package/dist/chunks/meta-BaFPvhc1.js.map +1 -0
  16. package/dist/chunks/meta-C58v1Oy0.js +28 -0
  17. package/dist/chunks/meta-C58v1Oy0.js.map +1 -0
  18. package/dist/chunks/meta-CQRXyexG.js +23 -0
  19. package/dist/chunks/meta-CQRXyexG.js.map +1 -0
  20. package/dist/chunks/meta-DrgM1eS0.js +23 -0
  21. package/dist/chunks/meta-DrgM1eS0.js.map +1 -0
  22. package/dist/chunks/meta-IhoaDXAV.js +19 -0
  23. package/dist/chunks/meta-IhoaDXAV.js.map +1 -0
  24. package/dist/chunks/meta-MQPbBUUB.js +29 -0
  25. package/dist/chunks/meta-MQPbBUUB.js.map +1 -0
  26. package/dist/chunks/meta-Qp4HNYAZ.js +24 -0
  27. package/dist/chunks/meta-Qp4HNYAZ.js.map +1 -0
  28. package/dist/chunks/meta-mns0uFIW.js +19 -0
  29. package/dist/chunks/meta-mns0uFIW.js.map +1 -0
  30. package/dist/datasets/celegans-neural.d.ts +1 -0
  31. package/dist/datasets/celegans-neural.js +7359 -0
  32. package/dist/datasets/celegans-neural.js.map +1 -0
  33. package/dist/datasets/contiguous-usa.d.ts +1 -0
  34. package/dist/datasets/contiguous-usa.js +501 -0
  35. package/dist/datasets/contiguous-usa.js.map +1 -0
  36. package/dist/datasets/davis-southern-women.d.ts +1 -0
  37. package/dist/datasets/davis-southern-women.js +235 -0
  38. package/dist/datasets/davis-southern-women.js.map +1 -0
  39. package/dist/datasets/dolphins.d.ts +1 -0
  40. package/dist/datasets/dolphins.js +406 -0
  41. package/dist/datasets/dolphins.js.map +1 -0
  42. package/dist/datasets/florentine-families.d.ts +1 -0
  43. package/dist/datasets/florentine-families.js +75 -0
  44. package/dist/datasets/florentine-families.js.map +1 -0
  45. package/dist/datasets/football.d.ts +1 -0
  46. package/dist/datasets/football.js +1508 -0
  47. package/dist/datasets/football.js.map +1 -0
  48. package/dist/datasets/karate.d.ts +1 -0
  49. package/dist/datasets/karate.js +295 -0
  50. package/dist/datasets/karate.js.map +1 -0
  51. package/dist/datasets/knuth-miles.d.ts +1 -0
  52. package/dist/datasets/knuth-miles.js +24933 -0
  53. package/dist/datasets/knuth-miles.js.map +1 -0
  54. package/dist/datasets/les-miserables.d.ts +1 -0
  55. package/dist/datasets/les-miserables.js +860 -0
  56. package/dist/datasets/les-miserables.js.map +1 -0
  57. package/dist/datasets/openflights.d.ts +1 -0
  58. package/dist/datasets/openflights.js +130277 -0
  59. package/dist/datasets/openflights.js.map +1 -0
  60. package/dist/datasets/political-blogs.d.ts +1 -0
  61. package/dist/datasets/political-blogs.js +42551 -0
  62. package/dist/datasets/political-blogs.js.map +1 -0
  63. package/dist/datasets/political-books.d.ts +1 -0
  64. package/dist/datasets/political-books.js +1124 -0
  65. package/dist/datasets/political-books.js.map +1 -0
  66. package/dist/generators.d.ts +1 -0
  67. package/dist/generators.js +4496 -0
  68. package/dist/generators.js.map +1 -0
  69. package/dist/graph-samples.d.ts +1 -0
  70. package/dist/graph-samples.js +142 -0
  71. package/dist/graph-samples.js.map +1 -0
  72. package/dist/src/datasets/build.d.ts +89 -0
  73. package/dist/src/datasets/build.d.ts.map +1 -0
  74. package/dist/src/datasets/build.js +53 -0
  75. package/dist/src/datasets/build.js.map +1 -0
  76. package/dist/src/datasets/catalog.d.ts +8 -0
  77. package/dist/src/datasets/catalog.d.ts.map +1 -0
  78. package/dist/src/datasets/catalog.js +34 -0
  79. package/dist/src/datasets/catalog.js.map +1 -0
  80. package/dist/src/datasets/celegans-neural/data.d.ts +3 -0
  81. package/dist/src/datasets/celegans-neural/data.d.ts.map +1 -0
  82. package/dist/src/datasets/celegans-neural/data.js +573 -0
  83. package/dist/src/datasets/celegans-neural/data.js.map +1 -0
  84. package/dist/src/datasets/celegans-neural/index.d.ts +11 -0
  85. package/dist/src/datasets/celegans-neural/index.d.ts.map +1 -0
  86. package/dist/src/datasets/celegans-neural/index.js +14 -0
  87. package/dist/src/datasets/celegans-neural/index.js.map +1 -0
  88. package/dist/src/datasets/celegans-neural/meta.d.ts +4 -0
  89. package/dist/src/datasets/celegans-neural/meta.d.ts.map +1 -0
  90. package/dist/src/datasets/celegans-neural/meta.js +21 -0
  91. package/dist/src/datasets/celegans-neural/meta.js.map +1 -0
  92. package/dist/src/datasets/contiguous-usa/data.d.ts +3 -0
  93. package/dist/src/datasets/contiguous-usa/data.d.ts.map +1 -0
  94. package/dist/src/datasets/contiguous-usa/data.js +162 -0
  95. package/dist/src/datasets/contiguous-usa/data.js.map +1 -0
  96. package/dist/src/datasets/contiguous-usa/index.d.ts +11 -0
  97. package/dist/src/datasets/contiguous-usa/index.d.ts.map +1 -0
  98. package/dist/src/datasets/contiguous-usa/index.js +14 -0
  99. package/dist/src/datasets/contiguous-usa/index.js.map +1 -0
  100. package/dist/src/datasets/contiguous-usa/meta.d.ts +4 -0
  101. package/dist/src/datasets/contiguous-usa/meta.d.ts.map +1 -0
  102. package/dist/src/datasets/contiguous-usa/meta.js +27 -0
  103. package/dist/src/datasets/contiguous-usa/meta.js.map +1 -0
  104. package/dist/src/datasets/davis-southern-women/data.d.ts +3 -0
  105. package/dist/src/datasets/davis-southern-women/data.d.ts.map +1 -0
  106. package/dist/src/datasets/davis-southern-women/data.js +57 -0
  107. package/dist/src/datasets/davis-southern-women/data.js.map +1 -0
  108. package/dist/src/datasets/davis-southern-women/index.d.ts +11 -0
  109. package/dist/src/datasets/davis-southern-women/index.d.ts.map +1 -0
  110. package/dist/src/datasets/davis-southern-women/index.js +14 -0
  111. package/dist/src/datasets/davis-southern-women/index.js.map +1 -0
  112. package/dist/src/datasets/davis-southern-women/meta.d.ts +4 -0
  113. package/dist/src/datasets/davis-southern-women/meta.d.ts.map +1 -0
  114. package/dist/src/datasets/davis-southern-women/meta.js +17 -0
  115. package/dist/src/datasets/davis-southern-women/meta.js.map +1 -0
  116. package/dist/src/datasets/dolphins/data.d.ts +3 -0
  117. package/dist/src/datasets/dolphins/data.d.ts.map +1 -0
  118. package/dist/src/datasets/dolphins/data.js +93 -0
  119. package/dist/src/datasets/dolphins/data.js.map +1 -0
  120. package/dist/src/datasets/dolphins/index.d.ts +11 -0
  121. package/dist/src/datasets/dolphins/index.d.ts.map +1 -0
  122. package/dist/src/datasets/dolphins/index.js +14 -0
  123. package/dist/src/datasets/dolphins/index.js.map +1 -0
  124. package/dist/src/datasets/dolphins/meta.d.ts +4 -0
  125. package/dist/src/datasets/dolphins/meta.d.ts.map +1 -0
  126. package/dist/src/datasets/dolphins/meta.js +17 -0
  127. package/dist/src/datasets/dolphins/meta.js.map +1 -0
  128. package/dist/src/datasets/florentine-families/data.d.ts +3 -0
  129. package/dist/src/datasets/florentine-families/data.d.ts.map +1 -0
  130. package/dist/src/datasets/florentine-families/data.js +31 -0
  131. package/dist/src/datasets/florentine-families/data.js.map +1 -0
  132. package/dist/src/datasets/florentine-families/index.d.ts +11 -0
  133. package/dist/src/datasets/florentine-families/index.d.ts.map +1 -0
  134. package/dist/src/datasets/florentine-families/index.js +14 -0
  135. package/dist/src/datasets/florentine-families/index.js.map +1 -0
  136. package/dist/src/datasets/florentine-families/meta.d.ts +4 -0
  137. package/dist/src/datasets/florentine-families/meta.d.ts.map +1 -0
  138. package/dist/src/datasets/florentine-families/meta.js +17 -0
  139. package/dist/src/datasets/florentine-families/meta.js.map +1 -0
  140. package/dist/src/datasets/football/data.d.ts +3 -0
  141. package/dist/src/datasets/football/data.d.ts.map +1 -0
  142. package/dist/src/datasets/football/data.js +210 -0
  143. package/dist/src/datasets/football/data.js.map +1 -0
  144. package/dist/src/datasets/football/index.d.ts +11 -0
  145. package/dist/src/datasets/football/index.d.ts.map +1 -0
  146. package/dist/src/datasets/football/index.js +14 -0
  147. package/dist/src/datasets/football/index.js.map +1 -0
  148. package/dist/src/datasets/football/meta.d.ts +4 -0
  149. package/dist/src/datasets/football/meta.d.ts.map +1 -0
  150. package/dist/src/datasets/football/meta.js +17 -0
  151. package/dist/src/datasets/football/meta.js.map +1 -0
  152. package/dist/src/datasets/hosted.d.ts +7 -0
  153. package/dist/src/datasets/hosted.d.ts.map +1 -0
  154. package/dist/src/datasets/hosted.js +80 -0
  155. package/dist/src/datasets/hosted.js.map +1 -0
  156. package/dist/src/datasets/karate/data.d.ts +3 -0
  157. package/dist/src/datasets/karate/data.d.ts.map +1 -0
  158. package/dist/src/datasets/karate/data.js +30 -0
  159. package/dist/src/datasets/karate/data.js.map +1 -0
  160. package/dist/src/datasets/karate/index.d.ts +11 -0
  161. package/dist/src/datasets/karate/index.d.ts.map +1 -0
  162. package/dist/src/datasets/karate/index.js +14 -0
  163. package/dist/src/datasets/karate/index.js.map +1 -0
  164. package/dist/src/datasets/karate/meta.d.ts +4 -0
  165. package/dist/src/datasets/karate/meta.d.ts.map +1 -0
  166. package/dist/src/datasets/karate/meta.js +22 -0
  167. package/dist/src/datasets/karate/meta.js.map +1 -0
  168. package/dist/src/datasets/knuth-miles/data.d.ts +3 -0
  169. package/dist/src/datasets/knuth-miles/data.d.ts.map +1 -0
  170. package/dist/src/datasets/knuth-miles/data.js +1203 -0
  171. package/dist/src/datasets/knuth-miles/data.js.map +1 -0
  172. package/dist/src/datasets/knuth-miles/index.d.ts +11 -0
  173. package/dist/src/datasets/knuth-miles/index.d.ts.map +1 -0
  174. package/dist/src/datasets/knuth-miles/index.js +14 -0
  175. package/dist/src/datasets/knuth-miles/index.js.map +1 -0
  176. package/dist/src/datasets/knuth-miles/meta.d.ts +4 -0
  177. package/dist/src/datasets/knuth-miles/meta.d.ts.map +1 -0
  178. package/dist/src/datasets/knuth-miles/meta.js +26 -0
  179. package/dist/src/datasets/knuth-miles/meta.js.map +1 -0
  180. package/dist/src/datasets/les-miserables/data.d.ts +3 -0
  181. package/dist/src/datasets/les-miserables/data.d.ts.map +1 -0
  182. package/dist/src/datasets/les-miserables/data.js +117 -0
  183. package/dist/src/datasets/les-miserables/data.js.map +1 -0
  184. package/dist/src/datasets/les-miserables/index.d.ts +11 -0
  185. package/dist/src/datasets/les-miserables/index.d.ts.map +1 -0
  186. package/dist/src/datasets/les-miserables/index.js +14 -0
  187. package/dist/src/datasets/les-miserables/index.js.map +1 -0
  188. package/dist/src/datasets/les-miserables/meta.d.ts +4 -0
  189. package/dist/src/datasets/les-miserables/meta.d.ts.map +1 -0
  190. package/dist/src/datasets/les-miserables/meta.js +21 -0
  191. package/dist/src/datasets/les-miserables/meta.js.map +1 -0
  192. package/dist/src/datasets/openflights/data.d.ts +3 -0
  193. package/dist/src/datasets/openflights/data.d.ts.map +1 -0
  194. package/dist/src/datasets/openflights/data.js +15457 -0
  195. package/dist/src/datasets/openflights/data.js.map +1 -0
  196. package/dist/src/datasets/openflights/index.d.ts +11 -0
  197. package/dist/src/datasets/openflights/index.d.ts.map +1 -0
  198. package/dist/src/datasets/openflights/index.js +14 -0
  199. package/dist/src/datasets/openflights/index.js.map +1 -0
  200. package/dist/src/datasets/openflights/meta.d.ts +4 -0
  201. package/dist/src/datasets/openflights/meta.d.ts.map +1 -0
  202. package/dist/src/datasets/openflights/meta.js +28 -0
  203. package/dist/src/datasets/openflights/meta.js.map +1 -0
  204. package/dist/src/datasets/political-blogs/data.d.ts +3 -0
  205. package/dist/src/datasets/political-blogs/data.d.ts.map +1 -0
  206. package/dist/src/datasets/political-blogs/data.js +4857 -0
  207. package/dist/src/datasets/political-blogs/data.js.map +1 -0
  208. package/dist/src/datasets/political-blogs/index.d.ts +11 -0
  209. package/dist/src/datasets/political-blogs/index.d.ts.map +1 -0
  210. package/dist/src/datasets/political-blogs/index.js +14 -0
  211. package/dist/src/datasets/political-blogs/index.js.map +1 -0
  212. package/dist/src/datasets/political-blogs/meta.d.ts +4 -0
  213. package/dist/src/datasets/political-blogs/meta.d.ts.map +1 -0
  214. package/dist/src/datasets/political-blogs/meta.js +26 -0
  215. package/dist/src/datasets/political-blogs/meta.js.map +1 -0
  216. package/dist/src/datasets/political-books/data.d.ts +3 -0
  217. package/dist/src/datasets/political-books/data.d.ts.map +1 -0
  218. package/dist/src/datasets/political-books/data.js +165 -0
  219. package/dist/src/datasets/political-books/data.js.map +1 -0
  220. package/dist/src/datasets/political-books/index.d.ts +11 -0
  221. package/dist/src/datasets/political-books/index.d.ts.map +1 -0
  222. package/dist/src/datasets/political-books/index.js +14 -0
  223. package/dist/src/datasets/political-books/index.js.map +1 -0
  224. package/dist/src/datasets/political-books/meta.d.ts +4 -0
  225. package/dist/src/datasets/political-books/meta.d.ts.map +1 -0
  226. package/dist/src/datasets/political-books/meta.js +20 -0
  227. package/dist/src/datasets/political-books/meta.js.map +1 -0
  228. package/dist/src/datasets/remote.d.ts +27 -0
  229. package/dist/src/datasets/remote.d.ts.map +1 -0
  230. package/dist/src/datasets/remote.js +30 -0
  231. package/dist/src/datasets/remote.js.map +1 -0
  232. package/dist/src/element.d.ts +20 -0
  233. package/dist/src/element.d.ts.map +1 -0
  234. package/dist/src/element.js +27 -0
  235. package/dist/src/element.js.map +1 -0
  236. package/dist/src/generators/bipartite.d.ts +51 -0
  237. package/dist/src/generators/bipartite.d.ts.map +1 -0
  238. package/dist/src/generators/bipartite.js +99 -0
  239. package/dist/src/generators/bipartite.js.map +1 -0
  240. package/dist/src/generators/block-model.d.ts +75 -0
  241. package/dist/src/generators/block-model.d.ts.map +1 -0
  242. package/dist/src/generators/block-model.js +116 -0
  243. package/dist/src/generators/block-model.js.map +1 -0
  244. package/dist/src/generators/classic.d.ts +208 -0
  245. package/dist/src/generators/classic.d.ts.map +1 -0
  246. package/dist/src/generators/classic.js +437 -0
  247. package/dist/src/generators/classic.js.map +1 -0
  248. package/dist/src/generators/degree-sequence.d.ts +273 -0
  249. package/dist/src/generators/degree-sequence.d.ts.map +1 -0
  250. package/dist/src/generators/degree-sequence.js +646 -0
  251. package/dist/src/generators/degree-sequence.js.map +1 -0
  252. package/dist/src/generators/directed.d.ts +141 -0
  253. package/dist/src/generators/directed.d.ts.map +1 -0
  254. package/dist/src/generators/directed.js +329 -0
  255. package/dist/src/generators/directed.js.map +1 -0
  256. package/dist/src/generators/erdos-renyi.d.ts +58 -0
  257. package/dist/src/generators/erdos-renyi.d.ts.map +1 -0
  258. package/dist/src/generators/erdos-renyi.js +154 -0
  259. package/dist/src/generators/erdos-renyi.js.map +1 -0
  260. package/dist/src/generators/flow.d.ts +153 -0
  261. package/dist/src/generators/flow.d.ts.map +1 -0
  262. package/dist/src/generators/flow.js +346 -0
  263. package/dist/src/generators/flow.js.map +1 -0
  264. package/dist/src/generators/geometric.d.ts +133 -0
  265. package/dist/src/generators/geometric.d.ts.map +1 -0
  266. package/dist/src/generators/geometric.js +495 -0
  267. package/dist/src/generators/geometric.js.map +1 -0
  268. package/dist/src/generators/growth.d.ts +187 -0
  269. package/dist/src/generators/growth.d.ts.map +1 -0
  270. package/dist/src/generators/growth.js +445 -0
  271. package/dist/src/generators/growth.js.map +1 -0
  272. package/dist/src/generators/hyperbolic.d.ts +84 -0
  273. package/dist/src/generators/hyperbolic.d.ts.map +1 -0
  274. package/dist/src/generators/hyperbolic.js +153 -0
  275. package/dist/src/generators/hyperbolic.js.map +1 -0
  276. package/dist/src/generators/index.d.ts +25 -0
  277. package/dist/src/generators/index.d.ts.map +1 -0
  278. package/dist/src/generators/index.js +24 -0
  279. package/dist/src/generators/index.js.map +1 -0
  280. package/dist/src/generators/lattices.d.ts +87 -0
  281. package/dist/src/generators/lattices.d.ts.map +1 -0
  282. package/dist/src/generators/lattices.js +237 -0
  283. package/dist/src/generators/lattices.js.map +1 -0
  284. package/dist/src/generators/lfr.d.ts +55 -0
  285. package/dist/src/generators/lfr.d.ts.map +1 -0
  286. package/dist/src/generators/lfr.js +178 -0
  287. package/dist/src/generators/lfr.js.map +1 -0
  288. package/dist/src/generators/named.d.ts +23 -0
  289. package/dist/src/generators/named.d.ts.map +1 -0
  290. package/dist/src/generators/named.js +191 -0
  291. package/dist/src/generators/named.js.map +1 -0
  292. package/dist/src/generators/preferential-attachment.d.ts +66 -0
  293. package/dist/src/generators/preferential-attachment.d.ts.map +1 -0
  294. package/dist/src/generators/preferential-attachment.js +157 -0
  295. package/dist/src/generators/preferential-attachment.js.map +1 -0
  296. package/dist/src/generators/trees-and-dags.d.ts +53 -0
  297. package/dist/src/generators/trees-and-dags.d.ts.map +1 -0
  298. package/dist/src/generators/trees-and-dags.js +108 -0
  299. package/dist/src/generators/trees-and-dags.js.map +1 -0
  300. package/dist/src/generators/util.d.ts +84 -0
  301. package/dist/src/generators/util.d.ts.map +1 -0
  302. package/dist/src/generators/util.js +138 -0
  303. package/dist/src/generators/util.js.map +1 -0
  304. package/dist/src/generators/variants.d.ts +85 -0
  305. package/dist/src/generators/variants.d.ts.map +1 -0
  306. package/dist/src/generators/variants.js +215 -0
  307. package/dist/src/generators/variants.js.map +1 -0
  308. package/dist/src/generators/weights.d.ts +65 -0
  309. package/dist/src/generators/weights.d.ts.map +1 -0
  310. package/dist/src/generators/weights.js +135 -0
  311. package/dist/src/generators/weights.js.map +1 -0
  312. package/dist/src/index.d.ts +12 -0
  313. package/dist/src/index.d.ts.map +1 -0
  314. package/dist/src/index.js +10 -0
  315. package/dist/src/index.js.map +1 -0
  316. package/dist/src/random/exp.d.ts +23 -0
  317. package/dist/src/random/exp.d.ts.map +1 -0
  318. package/dist/src/random/exp.js +101 -0
  319. package/dist/src/random/exp.js.map +1 -0
  320. package/dist/src/random/log.d.ts +19 -0
  321. package/dist/src/random/log.d.ts.map +1 -0
  322. package/dist/src/random/log.js +83 -0
  323. package/dist/src/random/log.js.map +1 -0
  324. package/dist/src/random/stream.d.ts +93 -0
  325. package/dist/src/random/stream.d.ts.map +1 -0
  326. package/dist/src/random/stream.js +154 -0
  327. package/dist/src/random/stream.js.map +1 -0
  328. package/dist/src/random/threefry.d.ts +19 -0
  329. package/dist/src/random/threefry.d.ts.map +1 -0
  330. package/dist/src/random/threefry.js +43 -0
  331. package/dist/src/random/threefry.js.map +1 -0
  332. package/dist/src/random/trig.d.ts +16 -0
  333. package/dist/src/random/trig.d.ts.map +1 -0
  334. package/dist/src/random/trig.js +78 -0
  335. package/dist/src/random/trig.js.map +1 -0
  336. package/dist/src/types.d.ts +28 -0
  337. package/dist/src/types.d.ts.map +1 -0
  338. package/dist/src/types.js +2 -0
  339. package/dist/src/types.js.map +1 -0
  340. package/package.json +102 -5
  341. package/src/datasets/build.ts +140 -0
  342. package/src/datasets/catalog.ts +35 -0
  343. package/src/datasets/celegans-neural/data.ts +575 -0
  344. package/src/datasets/celegans-neural/index.ts +17 -0
  345. package/src/datasets/celegans-neural/meta.ts +25 -0
  346. package/src/datasets/contiguous-usa/data.ts +164 -0
  347. package/src/datasets/contiguous-usa/index.ts +17 -0
  348. package/src/datasets/contiguous-usa/meta.ts +31 -0
  349. package/src/datasets/davis-southern-women/data.ts +59 -0
  350. package/src/datasets/davis-southern-women/index.ts +17 -0
  351. package/src/datasets/davis-southern-women/meta.ts +20 -0
  352. package/src/datasets/dolphins/data.ts +95 -0
  353. package/src/datasets/dolphins/index.ts +17 -0
  354. package/src/datasets/dolphins/meta.ts +21 -0
  355. package/src/datasets/florentine-families/data.ts +33 -0
  356. package/src/datasets/florentine-families/index.ts +17 -0
  357. package/src/datasets/florentine-families/meta.ts +20 -0
  358. package/src/datasets/football/data.ts +212 -0
  359. package/src/datasets/football/index.ts +17 -0
  360. package/src/datasets/football/meta.ts +20 -0
  361. package/src/datasets/hosted.ts +90 -0
  362. package/src/datasets/karate/data.ts +32 -0
  363. package/src/datasets/karate/index.ts +17 -0
  364. package/src/datasets/karate/meta.ts +25 -0
  365. package/src/datasets/knuth-miles/data.ts +1205 -0
  366. package/src/datasets/knuth-miles/index.ts +17 -0
  367. package/src/datasets/knuth-miles/meta.ts +29 -0
  368. package/src/datasets/les-miserables/data.ts +119 -0
  369. package/src/datasets/les-miserables/index.ts +17 -0
  370. package/src/datasets/les-miserables/meta.ts +24 -0
  371. package/src/datasets/openflights/data.ts +15459 -0
  372. package/src/datasets/openflights/index.ts +17 -0
  373. package/src/datasets/openflights/meta.ts +31 -0
  374. package/src/datasets/political-blogs/data.ts +4859 -0
  375. package/src/datasets/political-blogs/index.ts +17 -0
  376. package/src/datasets/political-blogs/meta.ts +30 -0
  377. package/src/datasets/political-books/data.ts +167 -0
  378. package/src/datasets/political-books/index.ts +17 -0
  379. package/src/datasets/political-books/meta.ts +23 -0
  380. package/src/datasets/remote.ts +42 -0
  381. package/src/element.ts +41 -0
  382. package/src/generators/bipartite.ts +127 -0
  383. package/src/generators/block-model.ts +160 -0
  384. package/src/generators/classic.ts +461 -0
  385. package/src/generators/degree-sequence.ts +807 -0
  386. package/src/generators/directed.ts +418 -0
  387. package/src/generators/erdos-renyi.ts +188 -0
  388. package/src/generators/flow.ts +443 -0
  389. package/src/generators/geometric.ts +591 -0
  390. package/src/generators/growth.ts +532 -0
  391. package/src/generators/hyperbolic.ts +193 -0
  392. package/src/generators/index.ts +133 -0
  393. package/src/generators/lattices.ts +290 -0
  394. package/src/generators/lfr.ts +227 -0
  395. package/src/generators/named.ts +198 -0
  396. package/src/generators/preferential-attachment.ts +188 -0
  397. package/src/generators/trees-and-dags.ts +139 -0
  398. package/src/generators/util.ts +167 -0
  399. package/src/generators/variants.ts +253 -0
  400. package/src/generators/weights.ts +177 -0
  401. package/src/index.ts +12 -0
  402. package/src/random/exp.ts +104 -0
  403. package/src/random/log.ts +86 -0
  404. package/src/random/stream.ts +169 -0
  405. package/src/random/threefry.ts +45 -0
  406. package/src/random/trig.ts +83 -0
  407. package/src/types.ts +28 -0
@@ -0,0 +1,461 @@
1
+ /**
2
+ * The deterministic families: no seed, closed-form structure, O(n + m). Every function returns an
3
+ * undirected simple graph whose node order and edge order are part of its contract (stated in each
4
+ * JSDoc), so an index means the same node in every version.
5
+ */
6
+
7
+ import { type U32 } from "@graphty/graph-format";
8
+
9
+ import { type SampleGraph } from "../types.js";
10
+ import { checkEdgeCount, checkInt, EdgeBuffer, toGraph } from "./util.js";
11
+ import { applyWeights, type WeightOptions } from "./weights.js";
12
+
13
+ /**
14
+ * Append every pair (lo + i, lo + j), i < j, of the clique on [lo, lo + size), row-major.
15
+ * @param out - the buffer
16
+ * @param lo - the first node
17
+ * @param size - the clique size
18
+ */
19
+ function pushClique(out: EdgeBuffer, lo: number, size: number): void {
20
+ for (let i = lo; i < lo + size; i++) {
21
+ for (let j = i + 1; j < lo + size; j++) {
22
+ out.push(i, j);
23
+ }
24
+ }
25
+ }
26
+
27
+ /**
28
+ * The path P_n: edges (i, i + 1) for i = 0 .. n - 2.
29
+ * @param options - the options
30
+ * @param options.n - the node count, >= 0
31
+ * @returns the graph
32
+ */
33
+ export function pathGraph(options: { n: number } & WeightOptions): SampleGraph {
34
+ const { n } = options;
35
+ checkInt("n", n, 0);
36
+ const out = new EdgeBuffer(n);
37
+ for (let i = 0; i + 1 < n; i++) {
38
+ out.push(i, i + 1);
39
+ }
40
+ return applyWeights(toGraph(n, out, false), options);
41
+ }
42
+
43
+ /**
44
+ * The cycle C_n: the path P_n plus the edge (n - 1, 0).
45
+ * @param options - the options
46
+ * @param options.n - the node count, >= 3
47
+ * @returns the graph
48
+ */
49
+ export function cycleGraph(options: { n: number } & WeightOptions): SampleGraph {
50
+ const { n } = options;
51
+ checkInt("n", n, 3);
52
+ const out = new EdgeBuffer(n);
53
+ for (let i = 0; i + 1 < n; i++) {
54
+ out.push(i, i + 1);
55
+ }
56
+ out.push(n - 1, 0);
57
+ return applyWeights(toGraph(n, out, false), options);
58
+ }
59
+
60
+ /**
61
+ * The star: hub 0 joined to every other node, edges (0, i) for i = 1 .. n - 1.
62
+ * @param options - the options
63
+ * @param options.n - the node count including the hub, >= 1
64
+ * @returns the graph
65
+ */
66
+ export function starGraph(options: { n: number } & WeightOptions): SampleGraph {
67
+ const { n } = options;
68
+ checkInt("n", n, 1);
69
+ const out = new EdgeBuffer(n);
70
+ for (let i = 1; i < n; i++) {
71
+ out.push(0, i);
72
+ }
73
+ return applyWeights(toGraph(n, out, false), options);
74
+ }
75
+
76
+ /**
77
+ * The wheel W_n: the star's spokes (0, i), then the rim (i, i + 1) for i = 1 .. n - 2, then
78
+ * (n - 1, 1).
79
+ * @param options - the options
80
+ * @param options.n - the node count including the hub, >= 4
81
+ * @returns the graph
82
+ */
83
+ export function wheelGraph(options: { n: number } & WeightOptions): SampleGraph {
84
+ const { n } = options;
85
+ checkInt("n", n, 4);
86
+ const out = new EdgeBuffer(2 * n);
87
+ for (let i = 1; i < n; i++) {
88
+ out.push(0, i);
89
+ }
90
+ for (let i = 1; i + 1 < n; i++) {
91
+ out.push(i, i + 1);
92
+ }
93
+ out.push(n - 1, 1);
94
+ return applyWeights(toGraph(n, out, false), options);
95
+ }
96
+
97
+ /**
98
+ * The complete graph K_n: every pair (i, j), i < j, row-major.
99
+ * @param options - the options
100
+ * @param options.n - the node count, >= 0
101
+ * @returns the graph
102
+ */
103
+ export function completeGraph(options: { n: number } & WeightOptions): SampleGraph {
104
+ const { n } = options;
105
+ checkInt("n", n, 0);
106
+ const m = (n * (n - 1)) / 2;
107
+ checkEdgeCount(m);
108
+ const out = new EdgeBuffer(m);
109
+ pushClique(out, 0, n);
110
+ return applyWeights(toGraph(n, out, false), options);
111
+ }
112
+
113
+ /**
114
+ * The complete bipartite graph K_{a,b}: left nodes 0 .. a - 1, right nodes a .. a + b - 1, every
115
+ * pair (i, a + j), row-major. Node column `side` (u8): 0 left, 1 right.
116
+ * @param options - the options
117
+ * @param options.a - the left side's size, >= 0
118
+ * @param options.b - the right side's size, >= 0
119
+ * @returns the graph
120
+ */
121
+ export function completeBipartiteGraph(options: { a: number; b: number } & WeightOptions): SampleGraph {
122
+ const { a, b } = options;
123
+ checkInt("a", a, 0);
124
+ checkInt("b", b, 0);
125
+ checkInt("a + b", a + b, 0);
126
+ checkEdgeCount(a * b);
127
+ const out = new EdgeBuffer(a * b);
128
+ for (let i = 0; i < a; i++) {
129
+ for (let j = 0; j < b; j++) {
130
+ out.push(i, a + j);
131
+ }
132
+ }
133
+ const side = new Uint8Array(a + b).fill(1, a);
134
+ return applyWeights(toGraph(a + b, out, false, { side }), options);
135
+ }
136
+
137
+ /**
138
+ * The hypercube Q_d: nodes are the d-bit integers, edges join integers one bit apart; for each node
139
+ * i in order and each bit b ascending that is 0 in i, the edge (i, i | 2^b).
140
+ * @param options - the options
141
+ * @param options.dimension - d, in [0, 26]
142
+ * @returns the graph
143
+ */
144
+ export function hypercubeGraph(options: { dimension: number } & WeightOptions): SampleGraph {
145
+ const { dimension } = options;
146
+ checkInt("dimension", dimension, 0, 26);
147
+ const n = 2 ** dimension;
148
+ const out = new EdgeBuffer((dimension * n) / 2);
149
+ for (let i = 0; i < n; i++) {
150
+ for (let b = 0; b < dimension; b++) {
151
+ const j = i | (1 << b);
152
+ if (j !== i) {
153
+ out.push(i, j);
154
+ }
155
+ }
156
+ }
157
+ return applyWeights(toGraph(n, out, false), options);
158
+ }
159
+
160
+ /**
161
+ * The ladder L_n: two paths 0 .. n - 1 and n .. 2n - 1, then the rungs (i, n + i).
162
+ * @param options - the options
163
+ * @param options.n - the number of rungs, >= 1
164
+ * @returns the graph
165
+ */
166
+ export function ladderGraph(options: { n: number } & WeightOptions): SampleGraph {
167
+ const { n } = options;
168
+ checkInt("n", n, 1);
169
+ checkInt("2n", 2 * n, 2);
170
+ return applyWeights(toGraph(2 * n, ladderEdges(n), false), options);
171
+ }
172
+
173
+ /**
174
+ * The barbell: a clique on 0 .. m1 - 1, the path m1 - 1, m1, .., m1 + m2 (m2 path nodes plus the
175
+ * two joining edges' ends), and a clique on m1 + m2 .. 2 m1 + m2 - 1. Edge order: left clique, path,
176
+ * right clique.
177
+ * @param options - the options
178
+ * @param options.cliqueSize - m1, each bell's size, >= 2
179
+ * @param options.pathLength - m2, the number of nodes on the bar, >= 0
180
+ * @returns the graph
181
+ */
182
+ export function barbellGraph(options: { cliqueSize: number; pathLength: number } & WeightOptions): SampleGraph {
183
+ const { cliqueSize: m1, pathLength: m2 } = options;
184
+ checkInt("cliqueSize", m1, 2);
185
+ checkInt("pathLength", m2, 0);
186
+ const n = 2 * m1 + m2;
187
+ checkInt("2 * cliqueSize + pathLength", n, 4);
188
+ checkEdgeCount(m1 * (m1 - 1) + m2 + 1);
189
+ const out = new EdgeBuffer(m1 * (m1 - 1) + m2 + 1);
190
+ pushClique(out, 0, m1);
191
+ for (let i = m1 - 1; i < m1 + m2; i++) {
192
+ out.push(i, i + 1);
193
+ }
194
+ pushClique(out, m1 + m2, m1);
195
+ return applyWeights(toGraph(n, out, false), options);
196
+ }
197
+
198
+ /**
199
+ * The lollipop: a clique on 0 .. m - 1 and a tail path m - 1, m, .., m + n - 1.
200
+ * @param options - the options
201
+ * @param options.cliqueSize - m, >= 2
202
+ * @param options.pathLength - n, the number of tail nodes, >= 0
203
+ * @returns the graph
204
+ */
205
+ export function lollipopGraph(options: { cliqueSize: number; pathLength: number } & WeightOptions): SampleGraph {
206
+ const { cliqueSize: m, pathLength } = options;
207
+ checkInt("cliqueSize", m, 2);
208
+ checkInt("pathLength", pathLength, 0);
209
+ checkInt("cliqueSize + pathLength", m + pathLength, 2);
210
+ checkEdgeCount((m * (m - 1)) / 2 + pathLength);
211
+ const out = new EdgeBuffer((m * (m - 1)) / 2 + pathLength);
212
+ pushClique(out, 0, m);
213
+ for (let i = m - 1; i + 1 < m + pathLength; i++) {
214
+ out.push(i, i + 1);
215
+ }
216
+ return applyWeights(toGraph(m + pathLength, out, false), options);
217
+ }
218
+
219
+ /**
220
+ * Community labels for `cliques` consecutive groups of `size` nodes.
221
+ * @param cliques - the number of groups
222
+ * @param size - the group size
223
+ * @returns the u32 labels
224
+ */
225
+ function groupLabels(cliques: number, size: number): U32 {
226
+ const community = new Uint32Array(cliques * size);
227
+ for (let g = 0; g < cliques; g++) {
228
+ community.fill(g, g * size, (g + 1) * size);
229
+ }
230
+ return community;
231
+ }
232
+
233
+ /**
234
+ * The caveman graph (Watts 1999): `cliques` disjoint cliques of `size` nodes, clique g on
235
+ * g * size .. (g + 1) * size - 1. Node column `community` (u32): the clique.
236
+ * @param options - the options
237
+ * @param options.cliques - the number of cliques, >= 1
238
+ * @param options.size - the clique size, >= 1
239
+ * @returns the graph
240
+ */
241
+ export function cavemanGraph(options: { cliques: number; size: number } & WeightOptions): SampleGraph {
242
+ const { cliques, size } = options;
243
+ checkInt("cliques", cliques, 1);
244
+ checkInt("size", size, 1);
245
+ const n = cliques * size;
246
+ checkInt("cliques * size", n, 1);
247
+ checkEdgeCount((n * (size - 1)) / 2);
248
+ const out = new EdgeBuffer((n * (size - 1)) / 2);
249
+ for (let g = 0; g < cliques; g++) {
250
+ pushClique(out, g * size, size);
251
+ }
252
+ return applyWeights(toGraph(n, out, false, { community: groupLabels(cliques, size) }), options);
253
+ }
254
+
255
+ /**
256
+ * The connected caveman graph (Watts 1999, as networkx builds it): the caveman graph with, in each
257
+ * clique starting at s, the edge (s, s + 1) replaced in place by (s, s - 1 mod n), which joins the
258
+ * cliques into a ring. Node column `community` (u32): the clique.
259
+ * @param options - the options
260
+ * @param options.cliques - the number of cliques, >= 2
261
+ * @param options.size - the clique size, >= 2
262
+ * @returns the graph
263
+ */
264
+ export function connectedCavemanGraph(options: { cliques: number; size: number } & WeightOptions): SampleGraph {
265
+ const { cliques, size } = options;
266
+ checkInt("cliques", cliques, 2);
267
+ checkInt("size", size, 2);
268
+ const n = cliques * size;
269
+ checkInt("cliques * size", n, 4);
270
+ checkEdgeCount((n * (size - 1)) / 2);
271
+ const out = new EdgeBuffer((n * (size - 1)) / 2);
272
+ for (let g = 0; g < cliques; g++) {
273
+ const s = g * size;
274
+ for (let i = s; i < s + size; i++) {
275
+ for (let j = i + 1; j < s + size; j++) {
276
+ if (i === s && j === s + 1) {
277
+ out.push(s, (s - 1 + n) % n);
278
+ } else {
279
+ out.push(i, j);
280
+ }
281
+ }
282
+ }
283
+ }
284
+ return applyWeights(toGraph(n, out, false, { community: groupLabels(cliques, size) }), options);
285
+ }
286
+
287
+ /**
288
+ * The balanced r-ary tree of height h, numbered breadth first: node i's children are
289
+ * r i + 1 .. r i + r; edges (parent(c), c) for c = 1 .. n - 1.
290
+ * @param options - the options
291
+ * @param options.branching - r, >= 1
292
+ * @param options.height - h, >= 0 (a single root at 0)
293
+ * @returns the graph
294
+ */
295
+ export function balancedTreeGraph(options: { branching: number; height: number } & WeightOptions): SampleGraph {
296
+ const { branching: r, height: h } = options;
297
+ checkInt("branching", r, 1);
298
+ checkInt("height", h, 0);
299
+ let n = 0;
300
+ let level = 1;
301
+ for (let d = 0; d <= h; d++) {
302
+ n += level;
303
+ level *= r;
304
+ checkInt("node count", n, 1);
305
+ }
306
+ const out = new EdgeBuffer(n);
307
+ for (let c = 1; c < n; c++) {
308
+ out.push(Math.floor((c - 1) / r), c);
309
+ }
310
+ return applyWeights(toGraph(n, out, false), options);
311
+ }
312
+
313
+ /**
314
+ * The Petersen graph: outer cycle 0 .. 4, spokes (i, i + 5), inner pentagram (5 + i, 5 + (i + 2) mod 5).
315
+ * 3-regular, girth 5, non-planar.
316
+ * @param options - the common weight options
317
+ * @returns the graph
318
+ */
319
+ export function petersenGraph(options: WeightOptions = {}): SampleGraph {
320
+ const out = new EdgeBuffer(15);
321
+ for (let i = 0; i < 5; i++) {
322
+ out.push(i, (i + 1) % 5);
323
+ }
324
+ for (let i = 0; i < 5; i++) {
325
+ out.push(i, i + 5);
326
+ }
327
+ for (let i = 0; i < 5; i++) {
328
+ out.push(5 + i, 5 + ((i + 2) % 5));
329
+ }
330
+ return applyWeights(toGraph(10, out, false), options);
331
+ }
332
+
333
+ /**
334
+ * The empty graph: n isolated nodes, no edges.
335
+ * @param options - the options
336
+ * @param options.n - the node count, >= 0
337
+ * @returns the graph
338
+ */
339
+ export function emptyGraph(options: { n: number } & WeightOptions): SampleGraph {
340
+ checkInt("n", options.n, 0);
341
+ return applyWeights(toGraph(options.n, new EdgeBuffer(0), false), options);
342
+ }
343
+
344
+ /**
345
+ * The complete multipartite graph K_{s0, s1, ...}: part p holds the next `sizes[p]` node indices,
346
+ * and every pair of nodes in different parts is joined; for each node in index order, the edges to
347
+ * every later node of a later part, ascending. Node column `part` (u32).
348
+ * @param options - the options
349
+ * @param options.sizes - the part sizes, each >= 0
350
+ * @returns the graph
351
+ */
352
+ export function completeMultipartiteGraph(options: { sizes: readonly number[] } & WeightOptions): SampleGraph {
353
+ const { sizes } = options;
354
+ const starts = [0];
355
+ for (let p = 0; p < sizes.length; p++) {
356
+ checkInt(`sizes[${p}]`, sizes[p], 0);
357
+ starts.push(starts[p] + sizes[p]);
358
+ }
359
+ const n = starts[sizes.length];
360
+ checkInt("the total size", n, 0);
361
+ let m = (n * (n - 1)) / 2;
362
+ for (const size of sizes) {
363
+ m -= (size * (size - 1)) / 2;
364
+ }
365
+ checkEdgeCount(m);
366
+ const part = new Uint32Array(n);
367
+ for (let p = 0; p < sizes.length; p++) {
368
+ part.fill(p, starts[p], starts[p + 1]);
369
+ }
370
+ const out = new EdgeBuffer(m);
371
+ for (let u = 0; u < n; u++) {
372
+ for (let v = starts[part[u] + 1]; v < n; v++) {
373
+ out.push(u, v);
374
+ }
375
+ }
376
+ return applyWeights(toGraph(n, out, false, { part }), options);
377
+ }
378
+
379
+ /**
380
+ * The circular ladder CL_n (the n-prism): the ladder's rails 0 .. n - 1 and n .. 2n - 1 and rungs
381
+ * (i, n + i), as {@link ladderGraph} lists them, then the closing edges (n - 1, 0) and
382
+ * (2n - 1, n). 3-regular and planar.
383
+ * @param options - the options
384
+ * @param options.n - the number of rungs, >= 3
385
+ * @returns the graph
386
+ */
387
+ export function circularLadderGraph(options: { n: number } & WeightOptions): SampleGraph {
388
+ const { n } = options;
389
+ checkInt("n", n, 3);
390
+ checkEdgeCount(3 * n);
391
+ const out = ladderEdges(n);
392
+ out.push(n - 1, 0);
393
+ out.push(2 * n - 1, n);
394
+ return applyWeights(toGraph(2 * n, out, false), options);
395
+ }
396
+
397
+ /**
398
+ * The Moebius ladder M_{2n}: the cycle 0 .. 2n - 1 (edges (i, i + 1), then (2n - 1, 0)) and the n
399
+ * chords (i, i + n). 3-regular and, unlike the circular ladder, not planar for n >= 3.
400
+ * @param options - the options
401
+ * @param options.n - the number of rungs, >= 3
402
+ * @returns the graph
403
+ */
404
+ export function mobiusLadderGraph(options: { n: number } & WeightOptions): SampleGraph {
405
+ const { n } = options;
406
+ checkInt("n", n, 3);
407
+ checkEdgeCount(3 * n);
408
+ const out = new EdgeBuffer(3 * n);
409
+ for (let i = 0; i + 1 < 2 * n; i++) {
410
+ out.push(i, i + 1);
411
+ }
412
+ out.push(2 * n - 1, 0);
413
+ for (let i = 0; i < n; i++) {
414
+ out.push(i, i + n);
415
+ }
416
+ return applyWeights(toGraph(2 * n, out, false), options);
417
+ }
418
+
419
+ /**
420
+ * The ladder's edges: two rails 0 .. n - 1 and n .. 2n - 1, then the rungs (i, n + i).
421
+ * @param n - the number of rungs
422
+ * @returns the buffer
423
+ */
424
+ function ladderEdges(n: number): EdgeBuffer {
425
+ const out = new EdgeBuffer(3 * n);
426
+ for (let side = 0; side < 2; side++) {
427
+ for (let i = 0; i + 1 < n; i++) {
428
+ out.push(side * n + i, side * n + i + 1);
429
+ }
430
+ }
431
+ for (let i = 0; i < n; i++) {
432
+ out.push(i, n + i);
433
+ }
434
+ return out;
435
+ }
436
+
437
+ /**
438
+ * The ring of cliques, as networkx's `ring_of_cliques`: for each clique i in order, its edges
439
+ * (row-major), then the ring edge (i size + 1, (i + 1) size mod n). The standard example of
440
+ * modularity's resolution limit (Fortunato and Barthelemy, PNAS 104:36-41, 2007,
441
+ * doi:10.1073/pnas.0605965104). Node column `community` (u32): the clique.
442
+ * @param options - the options
443
+ * @param options.cliques - the number of cliques, >= 2
444
+ * @param options.size - the clique size, >= 2
445
+ * @returns the graph
446
+ */
447
+ export function ringOfCliquesGraph(options: { cliques: number; size: number } & WeightOptions): SampleGraph {
448
+ const { cliques, size } = options;
449
+ checkInt("cliques", cliques, 2);
450
+ checkInt("size", size, 2);
451
+ const n = cliques * size;
452
+ checkInt("cliques * size", n, 4);
453
+ const m = (n * (size - 1)) / 2 + cliques;
454
+ checkEdgeCount(m);
455
+ const out = new EdgeBuffer(m);
456
+ for (let g = 0; g < cliques; g++) {
457
+ pushClique(out, g * size, size);
458
+ out.push(g * size + 1, ((g + 1) * size) % n);
459
+ }
460
+ return applyWeights(toGraph(n, out, false, { community: groupLabels(cliques, size) }), options);
461
+ }