@graphty/layout 1.2.5 → 1.2.7

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 (151) hide show
  1. package/README.md +109 -3
  2. package/dist/layout.js +1762 -0
  3. package/dist/layout.js.map +1 -0
  4. package/package.json +4 -3
  5. package/dist/src/algorithms/index.d.ts +0 -5
  6. package/dist/src/algorithms/index.js +0 -6
  7. package/dist/src/algorithms/index.js.map +0 -1
  8. package/dist/src/algorithms/optimization/index.d.ts +0 -7
  9. package/dist/src/algorithms/optimization/index.js +0 -7
  10. package/dist/src/algorithms/optimization/index.js.map +0 -1
  11. package/dist/src/algorithms/optimization/kamada-kawai-solver.d.ts +0 -32
  12. package/dist/src/algorithms/optimization/kamada-kawai-solver.js +0 -176
  13. package/dist/src/algorithms/optimization/kamada-kawai-solver.js.map +0 -1
  14. package/dist/src/algorithms/optimization/lbfgs.d.ts +0 -13
  15. package/dist/src/algorithms/optimization/lbfgs.js +0 -56
  16. package/dist/src/algorithms/optimization/lbfgs.js.map +0 -1
  17. package/dist/src/algorithms/optimization/line-search.d.ts +0 -15
  18. package/dist/src/algorithms/optimization/line-search.js +0 -37
  19. package/dist/src/algorithms/optimization/line-search.js.map +0 -1
  20. package/dist/src/algorithms/optimization/types.d.ts +0 -5
  21. package/dist/src/algorithms/optimization/types.js +0 -5
  22. package/dist/src/algorithms/optimization/types.js.map +0 -1
  23. package/dist/src/algorithms/planarity/check.d.ts +0 -17
  24. package/dist/src/algorithms/planarity/check.js +0 -30
  25. package/dist/src/algorithms/planarity/check.js.map +0 -1
  26. package/dist/src/algorithms/planarity/embedding.d.ts +0 -29
  27. package/dist/src/algorithms/planarity/embedding.js +0 -179
  28. package/dist/src/algorithms/planarity/embedding.js.map +0 -1
  29. package/dist/src/algorithms/planarity/index.d.ts +0 -7
  30. package/dist/src/algorithms/planarity/index.js +0 -8
  31. package/dist/src/algorithms/planarity/index.js.map +0 -1
  32. package/dist/src/algorithms/planarity/lr-test.d.ts +0 -15
  33. package/dist/src/algorithms/planarity/lr-test.js +0 -54
  34. package/dist/src/algorithms/planarity/lr-test.js.map +0 -1
  35. package/dist/src/algorithms/planarity/special-graphs.d.ts +0 -28
  36. package/dist/src/algorithms/planarity/special-graphs.js +0 -108
  37. package/dist/src/algorithms/planarity/special-graphs.js.map +0 -1
  38. package/dist/src/generators/basic.d.ts +0 -28
  39. package/dist/src/generators/basic.js +0 -79
  40. package/dist/src/generators/basic.js.map +0 -1
  41. package/dist/src/generators/bipartite.d.ts +0 -16
  42. package/dist/src/generators/bipartite.js +0 -40
  43. package/dist/src/generators/bipartite.js.map +0 -1
  44. package/dist/src/generators/grid.d.ts +0 -11
  45. package/dist/src/generators/grid.js +0 -37
  46. package/dist/src/generators/grid.js.map +0 -1
  47. package/dist/src/generators/index.d.ts +0 -8
  48. package/dist/src/generators/index.js +0 -9
  49. package/dist/src/generators/index.js.map +0 -1
  50. package/dist/src/generators/random.d.ts +0 -12
  51. package/dist/src/generators/random.js +0 -34
  52. package/dist/src/generators/random.js.map +0 -1
  53. package/dist/src/generators/scale-free.d.ts +0 -12
  54. package/dist/src/generators/scale-free.js +0 -62
  55. package/dist/src/generators/scale-free.js.map +0 -1
  56. package/dist/src/index.d.ts +0 -10
  57. package/dist/src/index.js +0 -15
  58. package/dist/src/index.js.map +0 -1
  59. package/dist/src/layouts/basic/index.d.ts +0 -4
  60. package/dist/src/layouts/basic/index.js +0 -5
  61. package/dist/src/layouts/basic/index.js.map +0 -1
  62. package/dist/src/layouts/basic/random.d.ts +0 -14
  63. package/dist/src/layouts/basic/random.js +0 -27
  64. package/dist/src/layouts/basic/random.js.map +0 -1
  65. package/dist/src/layouts/force-directed/arf.d.ts +0 -13
  66. package/dist/src/layouts/force-directed/arf.js +0 -103
  67. package/dist/src/layouts/force-directed/arf.js.map +0 -1
  68. package/dist/src/layouts/force-directed/forceatlas2.d.ts +0 -22
  69. package/dist/src/layouts/force-directed/forceatlas2.js +0 -340
  70. package/dist/src/layouts/force-directed/forceatlas2.js.map +0 -1
  71. package/dist/src/layouts/force-directed/fruchterman-reingold.d.ts +0 -19
  72. package/dist/src/layouts/force-directed/fruchterman-reingold.js +0 -131
  73. package/dist/src/layouts/force-directed/fruchterman-reingold.js.map +0 -1
  74. package/dist/src/layouts/force-directed/index.d.ts +0 -8
  75. package/dist/src/layouts/force-directed/index.js +0 -9
  76. package/dist/src/layouts/force-directed/index.js.map +0 -1
  77. package/dist/src/layouts/force-directed/kamada-kawai.d.ts +0 -15
  78. package/dist/src/layouts/force-directed/kamada-kawai.js +0 -87
  79. package/dist/src/layouts/force-directed/kamada-kawai.js.map +0 -1
  80. package/dist/src/layouts/force-directed/spring.d.ts +0 -19
  81. package/dist/src/layouts/force-directed/spring.js +0 -23
  82. package/dist/src/layouts/force-directed/spring.js.map +0 -1
  83. package/dist/src/layouts/geometric/circular.d.ts +0 -14
  84. package/dist/src/layouts/geometric/circular.js +0 -67
  85. package/dist/src/layouts/geometric/circular.js.map +0 -1
  86. package/dist/src/layouts/geometric/index.d.ts +0 -6
  87. package/dist/src/layouts/geometric/index.js +0 -7
  88. package/dist/src/layouts/geometric/index.js.map +0 -1
  89. package/dist/src/layouts/geometric/shell.d.ts +0 -15
  90. package/dist/src/layouts/geometric/shell.js +0 -67
  91. package/dist/src/layouts/geometric/shell.js.map +0 -1
  92. package/dist/src/layouts/geometric/spiral.d.ts +0 -16
  93. package/dist/src/layouts/geometric/spiral.js +0 -73
  94. package/dist/src/layouts/geometric/spiral.js.map +0 -1
  95. package/dist/src/layouts/hierarchical/bfs.d.ts +0 -12
  96. package/dist/src/layouts/hierarchical/bfs.js +0 -62
  97. package/dist/src/layouts/hierarchical/bfs.js.map +0 -1
  98. package/dist/src/layouts/hierarchical/bipartite.d.ts +0 -16
  99. package/dist/src/layouts/hierarchical/bipartite.js +0 -72
  100. package/dist/src/layouts/hierarchical/bipartite.js.map +0 -1
  101. package/dist/src/layouts/hierarchical/index.d.ts +0 -6
  102. package/dist/src/layouts/hierarchical/index.js +0 -7
  103. package/dist/src/layouts/hierarchical/index.js.map +0 -1
  104. package/dist/src/layouts/hierarchical/multipartite.d.ts +0 -12
  105. package/dist/src/layouts/hierarchical/multipartite.js +0 -73
  106. package/dist/src/layouts/hierarchical/multipartite.js.map +0 -1
  107. package/dist/src/layouts/index.d.ts +0 -8
  108. package/dist/src/layouts/index.js +0 -9
  109. package/dist/src/layouts/index.js.map +0 -1
  110. package/dist/src/layouts/specialized/index.d.ts +0 -5
  111. package/dist/src/layouts/specialized/index.js +0 -6
  112. package/dist/src/layouts/specialized/index.js.map +0 -1
  113. package/dist/src/layouts/specialized/planar.d.ts +0 -14
  114. package/dist/src/layouts/specialized/planar.js +0 -47
  115. package/dist/src/layouts/specialized/planar.js.map +0 -1
  116. package/dist/src/layouts/specialized/spectral.d.ts +0 -14
  117. package/dist/src/layouts/specialized/spectral.js +0 -106
  118. package/dist/src/layouts/specialized/spectral.js.map +0 -1
  119. package/dist/src/types/embedding.d.ts +0 -9
  120. package/dist/src/types/embedding.js +0 -5
  121. package/dist/src/types/embedding.js.map +0 -1
  122. package/dist/src/types/graph.d.ts +0 -10
  123. package/dist/src/types/graph.js +0 -5
  124. package/dist/src/types/graph.js.map +0 -1
  125. package/dist/src/types/index.d.ts +0 -6
  126. package/dist/src/types/index.js +0 -7
  127. package/dist/src/types/index.js.map +0 -1
  128. package/dist/src/types/layout.d.ts +0 -6
  129. package/dist/src/types/layout.js +0 -5
  130. package/dist/src/types/layout.js.map +0 -1
  131. package/dist/src/utils/graph.d.ts +0 -34
  132. package/dist/src/utils/graph.js +0 -69
  133. package/dist/src/utils/graph.js.map +0 -1
  134. package/dist/src/utils/index.d.ts +0 -8
  135. package/dist/src/utils/index.js +0 -9
  136. package/dist/src/utils/index.js.map +0 -1
  137. package/dist/src/utils/numpy.d.ts +0 -17
  138. package/dist/src/utils/numpy.js +0 -101
  139. package/dist/src/utils/numpy.js.map +0 -1
  140. package/dist/src/utils/params.d.ts +0 -17
  141. package/dist/src/utils/params.js +0 -22
  142. package/dist/src/utils/params.js.map +0 -1
  143. package/dist/src/utils/random.d.ts +0 -14
  144. package/dist/src/utils/random.js +0 -42
  145. package/dist/src/utils/random.js.map +0 -1
  146. package/dist/src/utils/rescale.d.ts +0 -21
  147. package/dist/src/utils/rescale.js +0 -194
  148. package/dist/src/utils/rescale.js.map +0 -1
  149. package/dist/vitest.config.d.ts +0 -2
  150. package/dist/vitest.config.js +0 -30
  151. package/dist/vitest.config.js.map +0 -1
@@ -1,108 +0,0 @@
1
- /**
2
- * Special graph detection functions for planarity testing
3
- */
4
- /**
5
- * Check if graph is K5 (complete graph with 5 nodes)
6
- *
7
- * @param nodes - List of nodes
8
- * @param edges - List of edges
9
- * @returns True if graph is K5
10
- */
11
- export function isK5(nodes, edges) {
12
- if (nodes.length !== 5)
13
- return false;
14
- // K5 has exactly 10 edges
15
- if (edges.length !== 10)
16
- return false;
17
- // Check if every pair of distinct nodes is connected
18
- for (let i = 0; i < nodes.length; i++) {
19
- for (let j = i + 1; j < nodes.length; j++) {
20
- const hasEdge = edges.some(e => (e[0] === nodes[i] && e[1] === nodes[j]) ||
21
- (e[0] === nodes[j] && e[1] === nodes[i]));
22
- if (!hasEdge)
23
- return false;
24
- }
25
- }
26
- return true;
27
- }
28
- /**
29
- * Check if graph is K3,3 (complete bipartite with 3,3 nodes)
30
- *
31
- * @param nodes - List of nodes
32
- * @param edges - List of edges
33
- * @returns True if graph is K3,3
34
- */
35
- export function isK33(nodes, edges) {
36
- if (nodes.length !== 6)
37
- return false;
38
- // K3,3 has exactly 9 edges
39
- if (edges.length !== 9)
40
- return false;
41
- // Try to find a bipartite partition
42
- const nodePartitions = tryFindBipartitePartition(nodes, edges);
43
- if (!nodePartitions)
44
- return false;
45
- const [part1, part2] = nodePartitions;
46
- // Check if both partitions have size 3
47
- if (part1.length !== 3 || part2.length !== 3)
48
- return false;
49
- // Check if every node in part1 is connected to every node in part2
50
- for (const n1 of part1) {
51
- for (const n2 of part2) {
52
- const hasEdge = edges.some(e => (e[0] === n1 && e[1] === n2) ||
53
- (e[0] === n2 && e[1] === n1));
54
- if (!hasEdge)
55
- return false;
56
- }
57
- }
58
- return true;
59
- }
60
- /**
61
- * Try to find a bipartite partition of the nodes
62
- *
63
- * @param nodes - List of nodes
64
- * @param edges - List of edges
65
- * @returns Array of two partitions, or null if not bipartite
66
- */
67
- export function tryFindBipartitePartition(nodes, edges) {
68
- const colorMap = {};
69
- const adjList = {};
70
- // Create adjacency list
71
- for (const node of nodes) {
72
- adjList[node] = [];
73
- }
74
- for (const [u, v] of edges) {
75
- adjList[u].push(v);
76
- adjList[v].push(u);
77
- }
78
- // BFS to color nodes
79
- const queue = [nodes[0]];
80
- colorMap[nodes[0]] = 0;
81
- while (queue.length > 0) {
82
- const node = queue.shift();
83
- const nodeColor = colorMap[node];
84
- for (const neighbor of adjList[node]) {
85
- if (colorMap[neighbor] === undefined) {
86
- colorMap[neighbor] = 1 - nodeColor; // Toggle color (0/1)
87
- queue.push(neighbor);
88
- }
89
- else if (colorMap[neighbor] === nodeColor) {
90
- // Conflict: not bipartite
91
- return null;
92
- }
93
- }
94
- }
95
- // Create partitions
96
- const part0 = [];
97
- const part1 = [];
98
- for (const node of nodes) {
99
- if (colorMap[node] === 0) {
100
- part0.push(node);
101
- }
102
- else {
103
- part1.push(node);
104
- }
105
- }
106
- return [part0, part1];
107
- }
108
- //# sourceMappingURL=special-graphs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"special-graphs.js","sourceRoot":"","sources":["../../../../src/algorithms/planarity/special-graphs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAC,KAAa,EAAE,KAAa;IAC/C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAErC,0BAA0B;IAC1B,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;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QAAQ,CAAC,IAAI,CAAC,CAAC;QAEjC,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,CAAC;gBACrC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,qBAAqB;gBACzD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvB,CAAC;iBAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,CAAC;gBAC5C,0BAA0B;gBAC1B,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAED,oBAAoB;IACpB,MAAM,KAAK,GAAW,EAAE,CAAC;IACzB,MAAM,KAAK,GAAW,EAAE,CAAC;IAEzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxB,CAAC"}
@@ -1,28 +0,0 @@
1
- /**
2
- * Basic graph generation functions
3
- */
4
- import { Graph } from '../types';
5
- /**
6
- * Create a complete graph with n nodes
7
- * @param n - Number of nodes
8
- * @returns Graph object with all nodes connected to all other nodes
9
- */
10
- export declare function completeGraph(n: number): Graph;
11
- /**
12
- * Create a cycle graph with n nodes
13
- * @param n - Number of nodes
14
- * @returns Graph object with nodes connected in a cycle
15
- */
16
- export declare function cycleGraph(n: number): Graph;
17
- /**
18
- * Create a star graph with n nodes (1 center + n-1 leaves)
19
- * @param n - Total number of nodes
20
- * @returns Graph object with star topology
21
- */
22
- export declare function starGraph(n: number): Graph;
23
- /**
24
- * Create a wheel graph with n nodes (1 center + n-1 rim nodes)
25
- * @param n - Total number of nodes
26
- * @returns Graph object with wheel topology
27
- */
28
- export declare function wheelGraph(n: number): Graph;
@@ -1,79 +0,0 @@
1
- /**
2
- * Basic graph generation functions
3
- */
4
- /**
5
- * Create a complete graph with n nodes
6
- * @param n - Number of nodes
7
- * @returns Graph object with all nodes connected to all other nodes
8
- */
9
- export function completeGraph(n) {
10
- const nodes = Array.from({ length: n }, (_, i) => i);
11
- const edges = [];
12
- for (let i = 0; i < n; i++) {
13
- for (let j = i + 1; j < n; j++) {
14
- edges.push([i, j]);
15
- }
16
- }
17
- return {
18
- nodes: () => nodes,
19
- edges: () => edges
20
- };
21
- }
22
- /**
23
- * Create a cycle graph with n nodes
24
- * @param n - Number of nodes
25
- * @returns Graph object with nodes connected in a cycle
26
- */
27
- export function cycleGraph(n) {
28
- const nodes = Array.from({ length: n }, (_, i) => i);
29
- const edges = [];
30
- for (let i = 0; i < n; i++) {
31
- edges.push([i, (i + 1) % n]);
32
- }
33
- return {
34
- nodes: () => nodes,
35
- edges: () => edges
36
- };
37
- }
38
- /**
39
- * Create a star graph with n nodes (1 center + n-1 leaves)
40
- * @param n - Total number of nodes
41
- * @returns Graph object with star topology
42
- */
43
- export function starGraph(n) {
44
- const nodes = Array.from({ length: n }, (_, i) => i);
45
- const edges = [];
46
- // Connect all nodes to node 0 (center)
47
- for (let i = 1; i < n; i++) {
48
- edges.push([0, i]);
49
- }
50
- return {
51
- nodes: () => nodes,
52
- edges: () => edges
53
- };
54
- }
55
- /**
56
- * Create a wheel graph with n nodes (1 center + n-1 rim nodes)
57
- * @param n - Total number of nodes
58
- * @returns Graph object with wheel topology
59
- */
60
- export function wheelGraph(n) {
61
- const nodes = Array.from({ length: n }, (_, i) => i);
62
- const edges = [];
63
- // Connect all rim nodes to center (node 0)
64
- for (let i = 1; i < n; i++) {
65
- edges.push([0, i]);
66
- }
67
- // Connect rim nodes in a cycle
68
- for (let i = 1; i < n - 1; i++) {
69
- edges.push([i, i + 1]);
70
- }
71
- if (n > 2) {
72
- edges.push([n - 1, 1]);
73
- }
74
- return {
75
- nodes: () => nodes,
76
- edges: () => edges
77
- };
78
- }
79
- //# sourceMappingURL=basic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"basic.js","sourceRoot":"","sources":["../../../src/generators/basic.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,CAAS;IACrC,MAAM,KAAK,GAAW,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAW,EAAE,CAAC;IAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;QAClB,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,MAAM,KAAK,GAAW,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAW,EAAE,CAAC;IAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,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AC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACV,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;QAClB,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Bipartite graph generation function
3
- */
4
- import { Graph, Node } from '../types';
5
- /**
6
- * Create a bipartite graph with two sets of nodes
7
- * @param n1 - Number of nodes in first set
8
- * @param n2 - Number of nodes in second set
9
- * @param p - Probability of edge between nodes in different sets
10
- * @param seed - Random seed for reproducibility
11
- * @returns Graph object with bipartite structure and setA/setB properties
12
- */
13
- export declare function bipartiteGraph(n1: number, n2: number, p: number, seed?: number): Graph & {
14
- setA: Node[];
15
- setB: Node[];
16
- };
@@ -1,40 +0,0 @@
1
- /**
2
- * Bipartite graph generation function
3
- */
4
- /**
5
- * Create a bipartite graph with two sets of nodes
6
- * @param n1 - Number of nodes in first set
7
- * @param n2 - Number of nodes in second set
8
- * @param p - Probability of edge between nodes in different sets
9
- * @param seed - Random seed for reproducibility
10
- * @returns Graph object with bipartite structure and setA/setB properties
11
- */
12
- export function bipartiteGraph(n1, n2, p, seed) {
13
- const setA = Array.from({ length: n1 }, (_, i) => `A${i}`);
14
- const setB = Array.from({ length: n2 }, (_, i) => `B${i}`);
15
- const nodes = [...setA, ...setB];
16
- const edges = [];
17
- // Simple deterministic pseudo-random if seed provided
18
- let currentSeed = seed;
19
- let random = seed !== undefined
20
- ? () => {
21
- currentSeed = (currentSeed * 9301 + 49297) % 233280;
22
- return currentSeed / 233280;
23
- }
24
- : Math.random;
25
- // Only connect nodes between sets
26
- for (const a of setA) {
27
- for (const b of setB) {
28
- if (random() < p) {
29
- edges.push([a, b]);
30
- }
31
- }
32
- }
33
- return {
34
- nodes: () => nodes,
35
- edges: () => edges,
36
- setA,
37
- setB
38
- };
39
- }
40
- //# sourceMappingURL=bipartite.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bipartite.js","sourceRoot":"","sources":["../../../src/generators/bipartite.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,EAAU,EAAE,EAAU,EAAE,CAAS,EAAE,IAAa;IAC7E,MAAM,IAAI,GAAW,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnE,MAAM,IAAI,GAAW,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnE,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAAW,EAAE,CAAC;IAEzB,sDAAsD;IACtD,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,MAAM,GAAG,IAAI,KAAK,SAAS;QAC7B,CAAC,CAAC,GAAG,EAAE;YACH,WAAW,GAAG,CAAC,WAAY,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC;YACrD,OAAO,WAAW,GAAG,MAAM,CAAC;QAC9B,CAAC;QACH,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAEhB,kCAAkC;IAClC,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACrB,IAAI,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;gBACjB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;QAClB,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;QAClB,IAAI;QACJ,IAAI;KACL,CAAC;AACJ,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * Grid graph generation function
3
- */
4
- import { Graph } from '../types';
5
- /**
6
- * Create a grid graph with rows x cols nodes
7
- * @param rows - Number of rows
8
- * @param cols - Number of columns
9
- * @returns Graph object with grid topology
10
- */
11
- export declare function gridGraph(rows: number, cols: number): Graph;
@@ -1,37 +0,0 @@
1
- /**
2
- * Grid graph generation function
3
- */
4
- /**
5
- * Create a grid graph with rows x cols nodes
6
- * @param rows - Number of rows
7
- * @param cols - Number of columns
8
- * @returns Graph object with grid topology
9
- */
10
- export function gridGraph(rows, cols) {
11
- const nodes = [];
12
- const edges = [];
13
- // Create nodes
14
- for (let i = 0; i < rows; i++) {
15
- for (let j = 0; j < cols; j++) {
16
- nodes.push(`${i},${j}`);
17
- }
18
- }
19
- // Create edges
20
- for (let i = 0; i < rows; i++) {
21
- for (let j = 0; j < cols; j++) {
22
- // Connect to right neighbor
23
- if (j < cols - 1) {
24
- edges.push([`${i},${j}`, `${i},${j + 1}`]);
25
- }
26
- // Connect to bottom neighbor
27
- if (i < rows - 1) {
28
- edges.push([`${i},${j}`, `${i + 1},${j}`]);
29
- }
30
- }
31
- }
32
- return {
33
- nodes: () => nodes,
34
- edges: () => edges
35
- };
36
- }
37
- //# sourceMappingURL=grid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../src/generators/grid.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;GAKG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- export { completeGraph, cycleGraph, starGraph, wheelGraph } from './basic';
5
- export { gridGraph } from './grid';
6
- export { randomGraph } from './random';
7
- export { bipartiteGraph } from './bipartite';
8
- export { scaleFreeGraph } from './scale-free';
@@ -1,9 +0,0 @@
1
- /**
2
- * Re-export all graph generation functions
3
- */
4
- export { completeGraph, cycleGraph, starGraph, wheelGraph } from './basic';
5
- export { gridGraph } from './grid';
6
- export { randomGraph } from './random';
7
- export { bipartiteGraph } from './bipartite';
8
- export { scaleFreeGraph } from './scale-free';
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,aAAa,EACb,UAAU,EACV,SAAS,EACT,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Random graph generation function
3
- */
4
- import { Graph } from '../types';
5
- /**
6
- * Create a random graph with n nodes and given edge probability
7
- * @param n - Number of nodes
8
- * @param p - Probability of edge between any two nodes (0-1)
9
- * @param seed - Random seed for reproducibility
10
- * @returns Graph object with random edges
11
- */
12
- export declare function randomGraph(n: number, p: number, seed?: number): Graph;
@@ -1,34 +0,0 @@
1
- /**
2
- * Random graph generation function
3
- */
4
- /**
5
- * Create a random graph with n nodes and given edge probability
6
- * @param n - Number of nodes
7
- * @param p - Probability of edge between any two nodes (0-1)
8
- * @param seed - Random seed for reproducibility
9
- * @returns Graph object with random edges
10
- */
11
- export function randomGraph(n, p, seed) {
12
- const nodes = Array.from({ length: n }, (_, i) => i);
13
- const edges = [];
14
- // Simple deterministic pseudo-random if seed provided
15
- let currentSeed = seed;
16
- let random = seed !== undefined
17
- ? () => {
18
- currentSeed = (currentSeed * 9301 + 49297) % 233280;
19
- return currentSeed / 233280;
20
- }
21
- : Math.random;
22
- for (let i = 0; i < n; i++) {
23
- for (let j = i + 1; j < n; j++) {
24
- if (random() < p) {
25
- edges.push([i, j]);
26
- }
27
- }
28
- }
29
- return {
30
- nodes: () => nodes,
31
- edges: () => edges
32
- };
33
- }
34
- //# sourceMappingURL=random.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"random.js","sourceRoot":"","sources":["../../../src/generators/random.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,CAAS,EAAE,CAAS,EAAE,IAAa;IAC7D,MAAM,KAAK,GAAW,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAW,EAAE,CAAC;IAEzB,sDAAsD;IACtD,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,MAAM,GAAG,IAAI,KAAK,SAAS;QAC7B,CAAC,CAAC,GAAG,EAAE;YACH,WAAW,GAAG,CAAC,WAAY,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC;YACrD,OAAO,WAAW,GAAG,MAAM,CAAC;QAC9B,CAAC;QACH,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/B,IAAI,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;gBACjB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;QAClB,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Scale-free graph generation function
3
- */
4
- import { Graph } from '../types';
5
- /**
6
- * Create a scale-free graph using Barabási-Albert model
7
- * @param n - Total number of nodes
8
- * @param m - Number of edges to attach from new node
9
- * @param seed - Random seed for reproducibility
10
- * @returns Graph object with scale-free properties
11
- */
12
- export declare function scaleFreeGraph(n: number, m: number, seed?: number): Graph;
@@ -1,62 +0,0 @@
1
- /**
2
- * Scale-free graph generation function
3
- */
4
- /**
5
- * Create a scale-free graph using Barabási-Albert model
6
- * @param n - Total number of nodes
7
- * @param m - Number of edges to attach from new node
8
- * @param seed - Random seed for reproducibility
9
- * @returns Graph object with scale-free properties
10
- */
11
- export function scaleFreeGraph(n, m, seed) {
12
- if (m >= n) {
13
- throw new Error('m must be less than n');
14
- }
15
- const nodes = Array.from({ length: n }, (_, i) => i);
16
- const edges = [];
17
- const degrees = new Array(n).fill(0);
18
- // Simple deterministic pseudo-random if seed provided
19
- let currentSeed = seed;
20
- let random = seed !== undefined
21
- ? () => {
22
- currentSeed = (currentSeed * 9301 + 49297) % 233280;
23
- return currentSeed / 233280;
24
- }
25
- : Math.random;
26
- // Start with complete graph of m+1 nodes
27
- for (let i = 0; i <= m; i++) {
28
- for (let j = i + 1; j <= m; j++) {
29
- edges.push([i, j]);
30
- degrees[i]++;
31
- degrees[j]++;
32
- }
33
- }
34
- // Add remaining nodes
35
- for (let i = m + 1; i < n; i++) {
36
- const targets = new Set();
37
- const totalDegree = degrees.reduce((sum, d) => sum + d, 0);
38
- // Choose m targets based on preferential attachment
39
- while (targets.size < m) {
40
- let r = random() * totalDegree;
41
- let cumSum = 0;
42
- for (let j = 0; j < i; j++) {
43
- cumSum += degrees[j];
44
- if (r <= cumSum && !targets.has(j)) {
45
- targets.add(j);
46
- break;
47
- }
48
- }
49
- }
50
- // Add edges to targets
51
- for (const target of targets) {
52
- edges.push([i, target]);
53
- degrees[i]++;
54
- degrees[target]++;
55
- }
56
- }
57
- return {
58
- nodes: () => nodes,
59
- edges: () => edges
60
- };
61
- }
62
- //# sourceMappingURL=scale-free.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scale-free.js","sourceRoot":"","sources":["../../../src/generators/scale-free.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,CAAS,EAAE,CAAS,EAAE,IAAa;IAChE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,KAAK,GAAW,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAW,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAErC,sDAAsD;IACtD,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,MAAM,GAAG,IAAI,KAAK,SAAS;QAC7B,CAAC,CAAC,GAAG,EAAE;YACH,WAAW,GAAG,CAAC,WAAY,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC;YACrD,OAAO,WAAW,GAAG,MAAM,CAAC;QAC9B,CAAC;QACH,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAEhB,yCAAyC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,G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,EAAE,CAAC;QACpB,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;QAClB,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Main entry point for @graphty/layout
3
- *
4
- * This file exports the complete public API, maintaining
5
- * compatibility with the original layout.ts file.
6
- */
7
- export * from './types';
8
- export { rescaleLayout, rescaleLayoutDict } from './utils/rescale';
9
- export * from './layouts';
10
- export * from './generators';
package/dist/src/index.js DELETED
@@ -1,15 +0,0 @@
1
- /**
2
- * Main entry point for @graphty/layout
3
- *
4
- * This file exports the complete public API, maintaining
5
- * compatibility with the original layout.ts file.
6
- */
7
- // Re-export all types
8
- export * from './types';
9
- // Re-export utilities that are part of the public API
10
- export { rescaleLayout, rescaleLayoutDict } from './utils/rescale';
11
- // Re-export all layout algorithms
12
- export * from './layouts';
13
- // Re-export all graph generation functions
14
- export * from './generators';
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,sBAAsB;AACtB,cAAc,SAAS,CAAC;AAExB,sDAAsD;AACtD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,kCAAkC;AAClC,cAAc,WAAW,CAAC;AAE1B,2CAA2C;AAC3C,cAAc,cAAc,CAAC"}
@@ -1,4 +0,0 @@
1
- /**
2
- * Basic layout algorithms
3
- */
4
- export { randomLayout } from './random';
@@ -1,5 +0,0 @@
1
- /**
2
- * Basic layout algorithms
3
- */
4
- export { randomLayout } from './random';
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/layouts/basic/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Random layout algorithm
3
- */
4
- import { Graph, Node, PositionMap } from '../../types';
5
- /**
6
- * Position nodes uniformly at random in the unit square.
7
- *
8
- * @param G - Graph or list of nodes
9
- * @param center - Coordinate pair around which to center the layout
10
- * @param dim - Dimension of layout
11
- * @param seed - Random seed for reproducible layouts
12
- * @returns Positions dictionary keyed by node
13
- */
14
- export declare function randomLayout(G: Graph | Node[], center?: number[] | null, dim?: number, seed?: number | null): PositionMap;
@@ -1,27 +0,0 @@
1
- /**
2
- * Random layout algorithm
3
- */
4
- import { _processParams } from '../../utils/params';
5
- import { getNodesFromGraph } from '../../utils/graph';
6
- import { RandomNumberGenerator } from '../../utils/random';
7
- /**
8
- * Position nodes uniformly at random in the unit square.
9
- *
10
- * @param G - Graph or list of nodes
11
- * @param center - Coordinate pair around which to center the layout
12
- * @param dim - Dimension of layout
13
- * @param seed - Random seed for reproducible layouts
14
- * @returns Positions dictionary keyed by node
15
- */
16
- export function randomLayout(G, center = null, dim = 2, seed = null) {
17
- const processed = _processParams(G, center, dim);
18
- const nodes = getNodesFromGraph(processed.G);
19
- center = processed.center;
20
- const rng = new RandomNumberGenerator(seed ?? undefined);
21
- const pos = {};
22
- nodes.forEach((node) => {
23
- pos[node] = rng.rand(dim).map((val, i) => val + center[i]);
24
- });
25
- return pos;
26
- }
27
- //# sourceMappingURL=random.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"random.js","sourceRoot":"","sources":["../../../../src/layouts/basic/random.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,CAAiB,EAAE,SAA0B,IAAI,EAAE,MAAc,CAAC,EAAE,OAAsB,IAAI;IACzH,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7C,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAE1B,MAAM,GAAG,GAAG,IAAI,qBAAqB,CAAC,IAAI,IAAI,SAAS,CAAC,CAAC;IACzD,MAAM,GAAG,GAAgB,EAAE,CAAC;IAE5B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAU,EAAE,EAAE;QAC3B,GAAG,CAAC,IAAI,CAAC,GAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAc,CAAC,GAAG,CAAC,CAAC,GAAW,EAAE,CAAS,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,13 +0,0 @@
1
- import type { Graph, PositionMap } from '../../types';
2
- /**
3
- * Layout algorithm with attractive and repulsive forces (ARF).
4
- *
5
- * @param G - Graph
6
- * @param pos - Initial positions for nodes
7
- * @param scaling - Scale factor for positions
8
- * @param a - Strength of springs between connected nodes (should be > 1)
9
- * @param maxIter - Maximum number of iterations
10
- * @param seed - Random seed for initial positions
11
- * @returns Positions dictionary keyed by node
12
- */
13
- export declare function arfLayout(G: Graph, pos?: PositionMap | null, scaling?: number, a?: number, maxIter?: number, seed?: number | null): PositionMap;