graphwise 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -1
- package/dist/__test__/fixtures/graphs/city-suburban-village.d.ts +3 -0
- package/dist/__test__/fixtures/graphs/city-suburban-village.d.ts.map +1 -0
- package/dist/__test__/fixtures/graphs/city-village.d.ts +3 -0
- package/dist/__test__/fixtures/graphs/city-village.d.ts.map +1 -0
- package/dist/__test__/fixtures/graphs/index.d.ts +13 -0
- package/dist/__test__/fixtures/graphs/index.d.ts.map +1 -0
- package/dist/__test__/fixtures/graphs/quality-vs-popularity.d.ts +3 -0
- package/dist/__test__/fixtures/graphs/quality-vs-popularity.d.ts.map +1 -0
- package/dist/__test__/fixtures/graphs/social-hub.d.ts +3 -0
- package/dist/__test__/fixtures/graphs/social-hub.d.ts.map +1 -0
- package/dist/__test__/fixtures/graphs/three-community.d.ts +3 -0
- package/dist/__test__/fixtures/graphs/three-community.d.ts.map +1 -0
- package/dist/__test__/fixtures/graphs/two-department.d.ts +3 -0
- package/dist/__test__/fixtures/graphs/two-department.d.ts.map +1 -0
- package/dist/__test__/fixtures/graphs/typed-entity.d.ts +3 -0
- package/dist/__test__/fixtures/graphs/typed-entity.d.ts.map +1 -0
- package/dist/__test__/fixtures/helpers.d.ts +66 -0
- package/dist/__test__/fixtures/helpers.d.ts.map +1 -0
- package/dist/__test__/fixtures/helpers.unit.test.d.ts +7 -0
- package/dist/__test__/fixtures/helpers.unit.test.d.ts.map +1 -0
- package/dist/__test__/fixtures/index.d.ts +10 -0
- package/dist/__test__/fixtures/index.d.ts.map +1 -0
- package/dist/__test__/fixtures/types.d.ts +35 -0
- package/dist/__test__/fixtures/types.d.ts.map +1 -0
- package/dist/expansion/dome.d.ts.map +1 -1
- package/dist/expansion/dome.integration.test.d.ts +18 -0
- package/dist/expansion/dome.integration.test.d.ts.map +1 -0
- package/dist/expansion/edge.d.ts +3 -3
- package/dist/expansion/edge.d.ts.map +1 -1
- package/dist/expansion/edge.integration.test.d.ts +11 -0
- package/dist/expansion/edge.integration.test.d.ts.map +1 -0
- package/dist/expansion/flux.d.ts +25 -0
- package/dist/expansion/flux.d.ts.map +1 -0
- package/dist/expansion/flux.integration.test.d.ts +14 -0
- package/dist/expansion/flux.integration.test.d.ts.map +1 -0
- package/dist/expansion/flux.unit.test.d.ts +2 -0
- package/dist/expansion/flux.unit.test.d.ts.map +1 -0
- package/dist/expansion/fuse.d.ts +28 -0
- package/dist/expansion/fuse.d.ts.map +1 -0
- package/dist/expansion/fuse.integration.test.d.ts +15 -0
- package/dist/expansion/fuse.integration.test.d.ts.map +1 -0
- package/dist/expansion/fuse.unit.test.d.ts +2 -0
- package/dist/expansion/fuse.unit.test.d.ts.map +1 -0
- package/dist/expansion/hae.d.ts +7 -7
- package/dist/expansion/hae.d.ts.map +1 -1
- package/dist/expansion/hae.integration.test.d.ts +11 -0
- package/dist/expansion/hae.integration.test.d.ts.map +1 -0
- package/dist/expansion/index.d.ts +6 -0
- package/dist/expansion/index.d.ts.map +1 -1
- package/dist/expansion/lace.d.ts +22 -0
- package/dist/expansion/lace.d.ts.map +1 -0
- package/dist/expansion/lace.integration.test.d.ts +14 -0
- package/dist/expansion/lace.integration.test.d.ts.map +1 -0
- package/dist/expansion/lace.unit.test.d.ts +2 -0
- package/dist/expansion/lace.unit.test.d.ts.map +1 -0
- package/dist/expansion/maze.d.ts +3 -13
- package/dist/expansion/maze.d.ts.map +1 -1
- package/dist/expansion/maze.integration.test.d.ts +11 -0
- package/dist/expansion/maze.integration.test.d.ts.map +1 -0
- package/dist/expansion/pipe.d.ts +3 -3
- package/dist/expansion/pipe.d.ts.map +1 -1
- package/dist/expansion/pipe.integration.test.d.ts +12 -0
- package/dist/expansion/pipe.integration.test.d.ts.map +1 -0
- package/dist/expansion/reach.d.ts +4 -14
- package/dist/expansion/reach.d.ts.map +1 -1
- package/dist/expansion/reach.integration.test.d.ts +9 -0
- package/dist/expansion/reach.integration.test.d.ts.map +1 -0
- package/dist/expansion/sage.d.ts +5 -13
- package/dist/expansion/sage.d.ts.map +1 -1
- package/dist/expansion/sage.integration.test.d.ts +9 -0
- package/dist/expansion/sage.integration.test.d.ts.map +1 -0
- package/dist/expansion/sift.d.ts +26 -0
- package/dist/expansion/sift.d.ts.map +1 -0
- package/dist/expansion/sift.integration.test.d.ts +13 -0
- package/dist/expansion/sift.integration.test.d.ts.map +1 -0
- package/dist/expansion/sift.unit.test.d.ts +2 -0
- package/dist/expansion/sift.unit.test.d.ts.map +1 -0
- package/dist/expansion/tide.d.ts +15 -0
- package/dist/expansion/tide.d.ts.map +1 -0
- package/dist/expansion/tide.integration.test.d.ts +14 -0
- package/dist/expansion/tide.integration.test.d.ts.map +1 -0
- package/dist/expansion/tide.unit.test.d.ts +2 -0
- package/dist/expansion/tide.unit.test.d.ts.map +1 -0
- package/dist/expansion/warp.d.ts +15 -0
- package/dist/expansion/warp.d.ts.map +1 -0
- package/dist/expansion/warp.integration.test.d.ts +13 -0
- package/dist/expansion/warp.integration.test.d.ts.map +1 -0
- package/dist/expansion/warp.unit.test.d.ts +2 -0
- package/dist/expansion/warp.unit.test.d.ts.map +1 -0
- package/dist/graph/adjacency-map.d.ts.map +1 -1
- package/dist/graph/index.cjs +7 -0
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.js +7 -0
- package/dist/graph/index.js.map +1 -1
- package/dist/index/index.cjs +287 -42
- package/dist/index/index.cjs.map +1 -1
- package/dist/index/index.js +282 -43
- package/dist/index/index.js.map +1 -1
- package/dist/ranking/mi/etch.integration.test.d.ts +2 -0
- package/dist/ranking/mi/etch.integration.test.d.ts.map +1 -0
- package/dist/ranking/mi/notch.integration.test.d.ts +2 -0
- package/dist/ranking/mi/notch.integration.test.d.ts.map +1 -0
- package/dist/ranking/mi/scale.d.ts.map +1 -1
- package/dist/ranking/mi/scale.integration.test.d.ts +2 -0
- package/dist/ranking/mi/scale.integration.test.d.ts.map +1 -0
- package/dist/ranking/mi/skew.integration.test.d.ts +2 -0
- package/dist/ranking/mi/skew.integration.test.d.ts.map +1 -0
- package/dist/ranking/mi/span.integration.test.d.ts +2 -0
- package/dist/ranking/mi/span.integration.test.d.ts.map +1 -0
- package/dist/ranking/parse.integration.test.d.ts +10 -0
- package/dist/ranking/parse.integration.test.d.ts.map +1 -0
- package/dist/structures/index.cjs +12 -2
- package/dist/structures/index.cjs.map +1 -1
- package/dist/structures/index.js +12 -2
- package/dist/structures/index.js.map +1 -1
- package/dist/structures/priority-queue.d.ts +4 -2
- package/dist/structures/priority-queue.d.ts.map +1 -1
- package/dist/utils/index.cjs +76 -77
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +76 -77
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# graphwise
|
|
2
2
|
|
|
3
|
+
[](https://doi.org/10.5281/zenodo.19209820)
|
|
3
4
|
[](https://www.npmjs.com/package/graphwise)
|
|
4
5
|
[](https://github.com/Mearman/graphwise)
|
|
5
6
|
|
|
@@ -7,7 +8,7 @@ Low-dependency TypeScript graph algorithms for citation network analysis: novel
|
|
|
7
8
|
|
|
8
9
|
## Features
|
|
9
10
|
|
|
10
|
-
- **Expansion algorithms**: BASE, DOME, EDGE, HAE, PIPE, SAGE, REACH, MAZE + baselines
|
|
11
|
+
- **Expansion algorithms**: BASE, DOME, EDGE, HAE, PIPE, SAGE, REACH, MAZE + 6 variants (TIDE, LACE, WARP, FUSE, SIFT, FLUX) + baselines
|
|
11
12
|
- **MI variants**: Jaccard, Adamic-Adar, SCALE, SKEW, SPAN, ETCH, NOTCH, Unified Adaptive
|
|
12
13
|
- **Path ranking**: PARSE + baselines (Katz, Communicability, PageRank, etc.)
|
|
13
14
|
- **Seed selection**: GRASP, Stratified
|
|
@@ -65,6 +66,76 @@ where $\deg^{+}(v)$ is weighted out-degree, $\deg^{-}(v)$ is weighted in-degree,
|
|
|
65
66
|
| **SAGE** | Salience accumulation from discovered paths | 2 |
|
|
66
67
|
| **REACH** | Rolling MI estimates of discovered path quality | 2 |
|
|
67
68
|
| **MAZE** | PIPE + SAGE + adaptive termination | 3 |
|
|
69
|
+
| **TIDE** | Sum of node + all-neighbour degrees | 1 |
|
|
70
|
+
| **LACE** | Average MI to same-frontier visited nodes | 1 |
|
|
71
|
+
| **WARP** | Cross-frontier bridge score | 1 |
|
|
72
|
+
| **FUSE** | Weighted degree + MI blend | 1 |
|
|
73
|
+
| **SIFT** | MI threshold with degree fallback | 1 |
|
|
74
|
+
| **FLUX** | Density-adaptive strategy switching | 1 |
|
|
75
|
+
|
|
76
|
+
#### EDGE: Entropy-Driven Graph Expansion
|
|
77
|
+
|
|
78
|
+
$$\pi_{\text{EDGE}}(v) = \frac{1}{H_{\text{local}}(v) + \varepsilon} \times \log(\deg(v) + 1)$$
|
|
79
|
+
|
|
80
|
+
where $H_{\text{local}}(v) = -\sum_{\tau} p(\tau) \log p(\tau)$ is the Shannon entropy of the neighbour type distribution. Nodes bridging heterogeneous structural regimes (high entropy) are explored first.
|
|
81
|
+
|
|
82
|
+
#### PIPE: Path-potential Informed Priority Expansion
|
|
83
|
+
|
|
84
|
+
$$\pi_{\text{PIPE}}(v) = \frac{\deg(v)}{1 + \text{path\_potential}(v)}$$
|
|
85
|
+
|
|
86
|
+
where $\text{path\_potential}(v) = |N(v) \cap \bigcup_{j \neq i} V_j|$ counts neighbours already visited by other seed frontiers. High path potential indicates imminent path completion.
|
|
87
|
+
|
|
88
|
+
#### SAGE: Salience-Accumulation Guided Expansion
|
|
89
|
+
|
|
90
|
+
$$\pi_{\text{SAGE}}(v) = \begin{cases} \log(\deg(v) + 1) & \text{Phase 1 (before first path)} \\ -(\text{salience}(v) \times 1000 - \deg(v)) & \text{Phase 2 (after first path)} \end{cases}$$
|
|
91
|
+
|
|
92
|
+
where $\text{salience}(v)$ counts discovered paths containing $v$. Salience dominates in Phase 2; degree serves as tiebreaker.
|
|
93
|
+
|
|
94
|
+
#### REACH: Retrospective Expansion with Adaptive Convergence
|
|
95
|
+
|
|
96
|
+
$$\pi_{\text{REACH}}(v) = \begin{cases} \log(\deg(v) + 1) & \text{Phase 1} \\ \log(\deg(v) + 1) \times (1 - \widehat{\text{MI}}(v)) & \text{Phase 2} \end{cases}$$
|
|
97
|
+
|
|
98
|
+
where $\widehat{\text{MI}}(v) = \frac{1}{|\mathcal{P}_{\text{top}}|} \sum_{p} J(N(v), N(p_{\text{endpoint}}))$ estimates MI via Jaccard similarity to discovered path endpoints.
|
|
99
|
+
|
|
100
|
+
#### MAZE: Multi-frontier Adaptive Zone Expansion
|
|
101
|
+
|
|
102
|
+
$$\pi^{(1)}(v) = \frac{\deg(v)}{1 + \text{path\_potential}(v)} \qquad \pi^{(2)}(v) = \pi^{(1)}(v) \times \frac{1}{1 + \lambda \cdot \text{salience}(v)}$$
|
|
103
|
+
|
|
104
|
+
Phase 1 uses PIPE's path potential until $M$ paths found. Phase 2 incorporates SAGE's salience feedback. Phase 3 evaluates diversity, path count, and salience plateau for termination.
|
|
105
|
+
|
|
106
|
+
#### TIDE: Total Interconnected Degree Expansion
|
|
107
|
+
|
|
108
|
+
$$\pi_{\text{TIDE}}(v) = \deg(v) + \sum_{w \in N(v)} \deg(w)$$
|
|
109
|
+
|
|
110
|
+
Nodes in sparse regions (low aggregate neighbourhood degree) are explored first. Related to EDGE but uses raw degree sums rather than entropy.
|
|
111
|
+
|
|
112
|
+
#### LACE: Local Affinity-Computed Expansion
|
|
113
|
+
|
|
114
|
+
$$\pi_{\text{LACE}}(v) = 1 - \overline{\text{MI}}(v, \text{frontier})$$
|
|
115
|
+
|
|
116
|
+
Prioritises nodes by average MI to already-visited frontier nodes. Related to HAE but uses MI to visited nodes rather than type entropy.
|
|
117
|
+
|
|
118
|
+
#### WARP: Weighted Adjacent Reachability Priority
|
|
119
|
+
|
|
120
|
+
$$\pi_{\text{WARP}}(v) = \frac{1}{1 + \text{bridge}(v)}$$
|
|
121
|
+
|
|
122
|
+
Pure cross-frontier bridge score without degree normalisation. Related to PIPE but omits the degree numerator.
|
|
123
|
+
|
|
124
|
+
#### FUSE: Fused Utility-Salience Expansion
|
|
125
|
+
|
|
126
|
+
$$\pi_{\text{FUSE}}(v) = (1 - w) \cdot \deg(v) + w \cdot (1 - \overline{\text{MI}})$$
|
|
127
|
+
|
|
128
|
+
Single-phase weighted blend of degree and MI. Related to SAGE but uses continuous blending rather than two-phase transition.
|
|
129
|
+
|
|
130
|
+
#### SIFT: Salience-Informed Frontier Threshold
|
|
131
|
+
|
|
132
|
+
$$\pi_{\text{SIFT}}(v) = \begin{cases} 1 - \overline{\text{MI}} & \text{if } \overline{\text{MI}} \geq \tau \\ \deg(v) + 100 & \text{otherwise} \end{cases}$$
|
|
133
|
+
|
|
134
|
+
MI-threshold-based priority with degree fallback. Related to REACH but uses a hard threshold instead of continuous MI-weighted priority.
|
|
135
|
+
|
|
136
|
+
#### FLUX: Flexible Local Utility Crossover
|
|
137
|
+
|
|
138
|
+
Density-adaptive strategy switching. Selects between DOME, EDGE, and PIPE modes per-node based on local graph density and cross-frontier bridge score. Related to MAZE but adapts spatially (per-node) rather than temporally (per-phase).
|
|
68
139
|
|
|
69
140
|
### Path Ranking: PARSE
|
|
70
141
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"city-suburban-village.d.ts","sourceRoot":"","sources":["../../../../src/__test__/fixtures/graphs/city-suburban-village.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,wBAAgB,gCAAgC,IAAI,gBAAgB,CA6HnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"city-village.d.ts","sourceRoot":"","sources":["../../../../src/__test__/fixtures/graphs/city-village.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,wBAAgB,wBAAwB,IAAI,gBAAgB,CAmF3D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test graph fixture builders.
|
|
3
|
+
*
|
|
4
|
+
* Each builder creates a complete test graph with nodes, edges, seeds, and metadata.
|
|
5
|
+
*/
|
|
6
|
+
export * from './social-hub';
|
|
7
|
+
export * from './two-department';
|
|
8
|
+
export * from './city-village';
|
|
9
|
+
export * from './city-suburban-village';
|
|
10
|
+
export * from './typed-entity';
|
|
11
|
+
export * from './three-community';
|
|
12
|
+
export * from './quality-vs-popularity';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/__test__/fixtures/graphs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quality-vs-popularity.d.ts","sourceRoot":"","sources":["../../../../src/__test__/fixtures/graphs/quality-vs-popularity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,wBAAgB,gCAAgC,IAAI,gBAAgB,CAgLnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"social-hub.d.ts","sourceRoot":"","sources":["../../../../src/__test__/fixtures/graphs/social-hub.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,wBAAgB,sBAAsB,IAAI,gBAAgB,CAuFzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"three-community.d.ts","sourceRoot":"","sources":["../../../../src/__test__/fixtures/graphs/three-community.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,wBAAgB,2BAA2B,IAAI,gBAAgB,CAqK9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"two-department.d.ts","sourceRoot":"","sources":["../../../../src/__test__/fixtures/graphs/two-department.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,wBAAgB,0BAA0B,IAAI,gBAAgB,CAwI7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-entity.d.ts","sourceRoot":"","sources":["../../../../src/__test__/fixtures/graphs/typed-entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,wBAAgB,wBAAwB,IAAI,gBAAgB,CAqG3D"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { NodeId, ReadableGraph, NodeData, EdgeData } from '../../graph';
|
|
2
|
+
import { ExpansionPath } from '../../expansion';
|
|
3
|
+
import { MIFunction } from '../../ranking/mi';
|
|
4
|
+
/**
|
|
5
|
+
* Create an ExpansionPath from an array of node IDs.
|
|
6
|
+
*
|
|
7
|
+
* The first node becomes the source seed and the last becomes the target seed.
|
|
8
|
+
* Useful for constructing paths in tests without manually creating Seed objects.
|
|
9
|
+
*
|
|
10
|
+
* @param nodes - Array of node IDs forming the path (must have at least 1 element)
|
|
11
|
+
* @returns ExpansionPath with fromSeed and toSeed inferred from endpoints
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const path = createPath(['A', 'B', 'C']);
|
|
16
|
+
* // path.fromSeed.id === 'A'
|
|
17
|
+
* // path.toSeed.id === 'C'
|
|
18
|
+
* // path.nodes === ['A', 'B', 'C']
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function createPath(nodes: readonly NodeId[]): ExpansionPath;
|
|
22
|
+
/**
|
|
23
|
+
* Compute the mean MI across all edges in a single path.
|
|
24
|
+
*
|
|
25
|
+
* Uses geometric mean to avoid length bias:
|
|
26
|
+
* M(P) = exp(1/k * sum(log(I(u_i, v_i)))) where k is the number of edges.
|
|
27
|
+
*
|
|
28
|
+
* For single-node paths (no edges), returns NaN.
|
|
29
|
+
* For empty paths, returns NaN.
|
|
30
|
+
*
|
|
31
|
+
* @param graph - Source graph
|
|
32
|
+
* @param path - The path to score
|
|
33
|
+
* @param mi - MI function to use
|
|
34
|
+
* @returns Geometric mean MI, or NaN if path has fewer than 2 nodes
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const path = createPath(['A', 'B', 'C']);
|
|
39
|
+
* const score = pathMI(graph, path, jaccard);
|
|
40
|
+
* // score is geometric mean of MI(A,B) and MI(B,C)
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function pathMI<N extends NodeData, E extends EdgeData>(graph: ReadableGraph<N, E>, path: ExpansionPath, mi: MIFunction<N, E>): number;
|
|
44
|
+
/**
|
|
45
|
+
* Compute the mean MI across all edges in all paths.
|
|
46
|
+
*
|
|
47
|
+
* Aggregates MI scores across multiple paths by taking the mean
|
|
48
|
+
* of individual path MIs. Paths with no edges (single-node paths)
|
|
49
|
+
* are excluded from the calculation.
|
|
50
|
+
*
|
|
51
|
+
* @param graph - Source graph
|
|
52
|
+
* @param paths - Array of paths to score
|
|
53
|
+
* @param mi - MI function to use
|
|
54
|
+
* @returns Mean MI across all valid paths, or 0 if no valid paths
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* const paths = [
|
|
59
|
+
* createPath(['A', 'B', 'C']),
|
|
60
|
+
* createPath(['D', 'E']),
|
|
61
|
+
* ];
|
|
62
|
+
* const avgScore = meanPathMI(graph, paths, jaccard);
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function meanPathMI<N extends NodeData, E extends EdgeData>(graph: ReadableGraph<N, E>, paths: readonly ExpansionPath[], mi: MIFunction<N, E>): number;
|
|
66
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/__test__/fixtures/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,aAAa,CAiBlE;AAoBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,EAC5D,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,IAAI,EAAE,aAAa,EACnB,EAAE,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAClB,MAAM,CAgCR;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,EAChE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,EAAE,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAClB,MAAM,CAeR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__test__/fixtures/helpers.unit.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test fixtures infrastructure.
|
|
3
|
+
*
|
|
4
|
+
* Provides types, helpers, and graph builders for integration tests
|
|
5
|
+
* across expansion, ranking, and other algorithms.
|
|
6
|
+
*/
|
|
7
|
+
export * from './types';
|
|
8
|
+
export * from './helpers';
|
|
9
|
+
export * from './graphs';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/__test__/fixtures/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { NodeData, EdgeData, ReadableGraph } from '../../graph';
|
|
2
|
+
import { Seed } from '../../expansion';
|
|
3
|
+
/**
|
|
4
|
+
* Knowledge graph node with optional label and type.
|
|
5
|
+
*/
|
|
6
|
+
export interface KGNode extends NodeData {
|
|
7
|
+
/** Human-readable label for the node */
|
|
8
|
+
readonly label: string;
|
|
9
|
+
/** Optional semantic type (e.g., 'person', 'organisation') */
|
|
10
|
+
readonly type?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Knowledge graph edge with optional weight and type.
|
|
14
|
+
*/
|
|
15
|
+
export interface KGEdge extends EdgeData {
|
|
16
|
+
/** Edge weight (default 1 for unweighted graphs) */
|
|
17
|
+
readonly weight?: number;
|
|
18
|
+
/** Optional semantic edge type (e.g., 'knows', 'mentors', 'cites') */
|
|
19
|
+
readonly type?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Test graph fixture: graph, seeds, and metadata.
|
|
23
|
+
*
|
|
24
|
+
* Provides a complete test context including the graph,
|
|
25
|
+
* initial seed nodes, and optional metadata about the fixture's properties.
|
|
26
|
+
*/
|
|
27
|
+
export interface TestGraphFixture {
|
|
28
|
+
/** The test graph */
|
|
29
|
+
readonly graph: ReadableGraph;
|
|
30
|
+
/** Seed nodes for expansion */
|
|
31
|
+
readonly seeds: readonly Seed[];
|
|
32
|
+
/** Optional metadata about the fixture (e.g. structure description) */
|
|
33
|
+
readonly metadata: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/__test__/fixtures/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,MAAO,SAAQ,QAAQ;IACvC,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,MAAO,SAAQ,QAAQ;IACvC,oDAAoD;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAChC,qBAAqB;IACrB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dome.d.ts","sourceRoot":"","sources":["../../src/expansion/dome.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EACX,IAAI,EACJ,eAAe,EACf,eAAe,EAEf,MAAM,SAAS,CAAC;AAGjB;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,EAC1D,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAC5B,eAAe,
|
|
1
|
+
{"version":3,"file":"dome.d.ts","sourceRoot":"","sources":["../../src/expansion/dome.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EACX,IAAI,EACJ,eAAe,EACf,eAAe,EAEf,MAAM,SAAS,CAAC;AAGjB;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,EAC1D,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAC5B,eAAe,CAajB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,EACpE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAC5B,eAAe,CAajB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration test for DOME expansion algorithm.
|
|
3
|
+
*
|
|
4
|
+
* DOME demonstrates hub deferral: it defers exploration of high-degree nodes
|
|
5
|
+
* and prioritises low-degree frontier expansion, discovering paths through
|
|
6
|
+
* sparse regions before exhausting hub-centric neighbours.
|
|
7
|
+
*
|
|
8
|
+
* This test uses a social network with a hub (Alice, degree 10+) and niche
|
|
9
|
+
* interest clusters. Bob (photography cluster) and Grace (hiking cluster) are
|
|
10
|
+
* separated and can be reached via two paths:
|
|
11
|
+
* - Hub path: bob → alice → grace (2 hops, alice degree 10)
|
|
12
|
+
* - Niche path: bob → carol → emma → grace (3 hops, carol/emma degree 3-4)
|
|
13
|
+
*
|
|
14
|
+
* DOME should discover the niche path first by deferring alice; standardBfs
|
|
15
|
+
* should discover the hub path first by expanding distance-1 neighbours.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=dome.integration.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dome.integration.test.d.ts","sourceRoot":"","sources":["../../src/expansion/dome.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
package/dist/expansion/edge.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { NodeData, EdgeData, ReadableGraph } from '../graph';
|
|
2
2
|
import { Seed, ExpansionResult, ExpansionConfig } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Run EDGE expansion
|
|
4
|
+
* Run EDGE expansion (Entropy-Driven Graph Expansion).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Discovers paths by prioritising nodes with diverse neighbour types,
|
|
7
|
+
* deferring nodes with homogeneous neighbourhoods.
|
|
8
8
|
*
|
|
9
9
|
* @param graph - Source graph
|
|
10
10
|
* @param seeds - Seed nodes for expansion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/expansion/edge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EACX,IAAI,EACJ,eAAe,EACf,eAAe,EAEf,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/expansion/edge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EACX,IAAI,EACJ,eAAe,EACf,eAAe,EAEf,MAAM,SAAS,CAAC;AAgCjB;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,EAC1D,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAC5B,eAAe,CAKjB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration test for EDGE expansion algorithm.
|
|
3
|
+
*
|
|
4
|
+
* EDGE discovers paths by prioritising nodes with diverse neighbour types.
|
|
5
|
+
* High entropy (heterogeneous neighbourhoods) are expanded before low entropy
|
|
6
|
+
* (homogeneous neighbourhoods).
|
|
7
|
+
*
|
|
8
|
+
* This test demonstrates EDGE's behaviour on a graph with mixed node types.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=edge.integration.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.integration.test.d.ts","sourceRoot":"","sources":["../../src/expansion/edge.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NodeData, EdgeData, ReadableGraph } from '../graph';
|
|
2
|
+
import { Seed, ExpansionResult, ExpansionConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for MAZE expansion.
|
|
5
|
+
*/
|
|
6
|
+
export interface MAZEConfig<N extends NodeData = NodeData, E extends EdgeData = EdgeData> extends ExpansionConfig<N, E> {
|
|
7
|
+
/** Density threshold for switching to EDGE mode (default: 0.5) */
|
|
8
|
+
readonly densityThreshold?: number;
|
|
9
|
+
/** Bridge threshold for switching to PIPE mode (default: 0.3) */
|
|
10
|
+
readonly bridgeThreshold?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Run FLUX expansion algorithm.
|
|
14
|
+
*
|
|
15
|
+
* Adaptively switches between expansion strategies based on
|
|
16
|
+
* local graph structure. Useful for heterogeneous graphs
|
|
17
|
+
* with varying density.
|
|
18
|
+
*
|
|
19
|
+
* @param graph - Source graph
|
|
20
|
+
* @param seeds - Seed nodes for expansion
|
|
21
|
+
* @param config - Expansion configuration
|
|
22
|
+
* @returns Expansion result with discovered paths
|
|
23
|
+
*/
|
|
24
|
+
export declare function flux<N extends NodeData, E extends EdgeData>(graph: ReadableGraph<N, E>, seeds: readonly Seed[], config?: MAZEConfig<N, E>): ExpansionResult;
|
|
25
|
+
//# sourceMappingURL=flux.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flux.d.ts","sourceRoot":"","sources":["../../src/expansion/flux.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EACX,IAAI,EACJ,eAAe,EACf,eAAe,EAEf,MAAM,SAAS,CAAC;AAGjB;;GAEG;AACH,MAAM,WAAW,UAAU,CAC1B,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAC7B,CAAC,SAAS,QAAQ,GAAG,QAAQ,CAC5B,SAAQ,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9B,kEAAkE;IAClE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,iEAAiE;IACjE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CAClC;AA8FD;;;;;;;;;;;GAWG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,EAC1D,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GACvB,eAAe,CAcjB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration test for FLUX expansion algorithm.
|
|
3
|
+
*
|
|
4
|
+
* FLUX (Multi-phase Adaptive Zone Exploration) combines PIPE (phase 1),
|
|
5
|
+
* SAGE (phase 2), and adaptive termination to discover paths across regions
|
|
6
|
+
* of varying density. It switches strategies based on local structure and
|
|
7
|
+
* discovers more paths than single-strategy algorithms.
|
|
8
|
+
*
|
|
9
|
+
* This test uses a three-density network (city, suburban, village). FLUX
|
|
10
|
+
* should discover paths through all regions and total paths ≥ DOME/EDGE
|
|
11
|
+
* because it adapts strategy to local density.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=flux.integration.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flux.integration.test.d.ts","sourceRoot":"","sources":["../../src/expansion/flux.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flux.unit.test.d.ts","sourceRoot":"","sources":["../../src/expansion/flux.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NodeData, EdgeData, ReadableGraph } from '../graph';
|
|
2
|
+
import { Seed, ExpansionResult, ExpansionConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for FUSE expansion.
|
|
5
|
+
*/
|
|
6
|
+
export interface FUSEConfig<N extends NodeData = NodeData, E extends EdgeData = EdgeData> extends ExpansionConfig<N, E> {
|
|
7
|
+
/** MI function for salience computation (default: jaccard) */
|
|
8
|
+
readonly mi?: (graph: ReadableGraph<N, E>, source: string, target: string) => number;
|
|
9
|
+
/** Weight for salience component (0-1, default: 0.5) */
|
|
10
|
+
readonly salienceWeight?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use {@link FUSEConfig} instead.
|
|
14
|
+
*/
|
|
15
|
+
export type SAGEConfig<N extends NodeData = NodeData, E extends EdgeData = EdgeData> = FUSEConfig<N, E>;
|
|
16
|
+
/**
|
|
17
|
+
* Run FUSE expansion algorithm.
|
|
18
|
+
*
|
|
19
|
+
* Combines structural exploration with semantic salience.
|
|
20
|
+
* Useful for finding paths that are both short and semantically meaningful.
|
|
21
|
+
*
|
|
22
|
+
* @param graph - Source graph
|
|
23
|
+
* @param seeds - Seed nodes for expansion
|
|
24
|
+
* @param config - Expansion configuration with MI function
|
|
25
|
+
* @returns Expansion result with discovered paths
|
|
26
|
+
*/
|
|
27
|
+
export declare function fuse<N extends NodeData, E extends EdgeData>(graph: ReadableGraph<N, E>, seeds: readonly Seed[], config?: FUSEConfig<N, E>): ExpansionResult;
|
|
28
|
+
//# sourceMappingURL=fuse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fuse.d.ts","sourceRoot":"","sources":["../../src/expansion/fuse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EACX,IAAI,EACJ,eAAe,EACf,eAAe,EAEf,MAAM,SAAS,CAAC;AAIjB;;GAEG;AACH,MAAM,WAAW,UAAU,CAC1B,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAC7B,CAAC,SAAS,QAAQ,GAAG,QAAQ,CAC5B,SAAQ,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9B,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,CAAC,EAAE,CACb,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,KACV,MAAM,CAAC;IACZ,wDAAwD;IACxD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,CACrB,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAC7B,CAAC,SAAS,QAAQ,GAAG,QAAQ,IAC1B,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAyCrB;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,EAC1D,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GACvB,eAAe,CAUjB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration test for FUSE expansion algorithm.
|
|
3
|
+
*
|
|
4
|
+
* FUSE (Salience-guided Adaptive Graph Expansion) is a two-phase algorithm
|
|
5
|
+
* that accumulates salience feedback from discovered paths. Early high-MI paths
|
|
6
|
+
* guide later exploration, causing FUSE to discover more high-quality paths
|
|
7
|
+
* than single-phase algorithms like DOME within the same node budget.
|
|
8
|
+
*
|
|
9
|
+
* This test uses the quality-vs-popularity network where two paths exist:
|
|
10
|
+
* one via a famous hub (low MI) and one via specialist clusters (high MI).
|
|
11
|
+
* FUSE should preferentially discover the specialist path due to salience
|
|
12
|
+
* accumulation.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=fuse.integration.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fuse.integration.test.d.ts","sourceRoot":"","sources":["../../src/expansion/fuse.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fuse.unit.test.d.ts","sourceRoot":"","sources":["../../src/expansion/fuse.unit.test.ts"],"names":[],"mappings":""}
|
package/dist/expansion/hae.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { NodeData, EdgeData, ReadableGraph } from '../graph';
|
|
2
2
|
import { Seed, ExpansionResult, ExpansionConfig } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Configuration for HAE
|
|
4
|
+
* Configuration for HAE, extending base ExpansionConfig.
|
|
5
5
|
*/
|
|
6
6
|
export interface HAEConfig<N extends NodeData = NodeData, E extends EdgeData = EdgeData> extends ExpansionConfig<N, E> {
|
|
7
|
-
/**
|
|
8
|
-
readonly
|
|
7
|
+
/** Function to extract type from a node (default: node.type) */
|
|
8
|
+
readonly typeMapper?: (node: N) => string;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Run HAE expansion
|
|
11
|
+
* Run HAE expansion (Heterogeneity-Aware Expansion).
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Discovers paths by prioritising nodes with diverse neighbour types,
|
|
14
|
+
* using a custom type mapper for flexible type extraction.
|
|
15
15
|
*
|
|
16
16
|
* @param graph - Source graph
|
|
17
17
|
* @param seeds - Seed nodes for expansion
|
|
18
|
-
* @param config -
|
|
18
|
+
* @param config - HAE configuration with optional typeMapper
|
|
19
19
|
* @returns Expansion result with discovered paths
|
|
20
20
|
*/
|
|
21
21
|
export declare function hae<N extends NodeData, E extends EdgeData>(graph: ReadableGraph<N, E>, seeds: readonly Seed[], config?: HAEConfig<N, E>): ExpansionResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hae.d.ts","sourceRoot":"","sources":["../../src/expansion/hae.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hae.d.ts","sourceRoot":"","sources":["../../src/expansion/hae.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EACX,IAAI,EACJ,eAAe,EACf,eAAe,EAEf,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,MAAM,WAAW,SAAS,CACzB,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAC7B,CAAC,SAAS,QAAQ,GAAG,QAAQ,CAC5B,SAAQ,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9B,gEAAgE;IAChE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;CAC1C;AAuCD;;;;;;;;;;GAUG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,EACzD,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GACtB,eAAe,CAOjB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration test for HAE expansion algorithm.
|
|
3
|
+
*
|
|
4
|
+
* HAE (Heterogeneity-Aware Expansion) generalises EDGE by allowing
|
|
5
|
+
* custom type extraction via a user-supplied typeMapper function.
|
|
6
|
+
*
|
|
7
|
+
* This test demonstrates HAE's ability to use custom type definitions
|
|
8
|
+
* beyond the default node.type property.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=hae.integration.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hae.integration.test.d.ts","sourceRoot":"","sources":["../../src/expansion/hae.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -15,6 +15,12 @@ export * from './pipe';
|
|
|
15
15
|
export * from './sage';
|
|
16
16
|
export * from './reach';
|
|
17
17
|
export * from './maze';
|
|
18
|
+
export * from './tide';
|
|
19
|
+
export * from './lace';
|
|
20
|
+
export * from './warp';
|
|
21
|
+
export * from './fuse';
|
|
22
|
+
export * from './sift';
|
|
23
|
+
export * from './flux';
|
|
18
24
|
export * from './standard-bfs';
|
|
19
25
|
export * from './frontier-balanced';
|
|
20
26
|
export * from './random-priority';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expansion/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expansion/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NodeData, EdgeData, ReadableGraph } from '../graph';
|
|
2
|
+
import { Seed, ExpansionResult, ExpansionConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for LACE expansion.
|
|
5
|
+
*/
|
|
6
|
+
export interface LACEConfig<N extends NodeData = NodeData, E extends EdgeData = EdgeData> extends ExpansionConfig<N, E> {
|
|
7
|
+
/** MI function for computing edge priorities (default: jaccard) */
|
|
8
|
+
readonly mi?: (graph: ReadableGraph<N, E>, source: string, target: string) => number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Run LACE expansion algorithm.
|
|
12
|
+
*
|
|
13
|
+
* Expands from seeds prioritising high-MI edges.
|
|
14
|
+
* Useful for finding paths with strong semantic associations.
|
|
15
|
+
*
|
|
16
|
+
* @param graph - Source graph
|
|
17
|
+
* @param seeds - Seed nodes for expansion
|
|
18
|
+
* @param config - Expansion configuration with MI function
|
|
19
|
+
* @returns Expansion result with discovered paths
|
|
20
|
+
*/
|
|
21
|
+
export declare function lace<N extends NodeData, E extends EdgeData>(graph: ReadableGraph<N, E>, seeds: readonly Seed[], config?: LACEConfig<N, E>): ExpansionResult;
|
|
22
|
+
//# sourceMappingURL=lace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lace.d.ts","sourceRoot":"","sources":["../../src/expansion/lace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EACX,IAAI,EACJ,eAAe,EACf,eAAe,EAEf,MAAM,SAAS,CAAC;AAIjB;;GAEG;AACH,MAAM,WAAW,UAAU,CAC1B,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAC7B,CAAC,SAAS,QAAQ,GAAG,QAAQ,CAC5B,SAAQ,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,CAAC,EAAE,CACb,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,KACV,MAAM,CAAC;CACZ;AA0CD;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,EAC1D,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GACvB,eAAe,CAUjB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration test for LACE expansion algorithm.
|
|
3
|
+
*
|
|
4
|
+
* LACE (Local Adaptive Community Entropy) is a single-phase algorithm that uses
|
|
5
|
+
* a user-supplied entropy function for node prioritisation. Unlike TIDE
|
|
6
|
+
* (which computes neighbourhood type entropy), LACE generalises to arbitrary
|
|
7
|
+
* entropy measures.
|
|
8
|
+
*
|
|
9
|
+
* This test demonstrates that LACE with an MI-based entropy function discovers
|
|
10
|
+
* paths with higher mean MI than DOME (which uses degree-based priority).
|
|
11
|
+
* LACE's pure MI prioritisation should prefer quality edges over high-degree hubs.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=lace.integration.test.d.ts.map
|