@claude-flow/plugin-hyperbolic-reasoning 3.0.0-alpha.1
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 +318 -0
- package/dist/bridges/gnn-bridge.d.ts +127 -0
- package/dist/bridges/gnn-bridge.d.ts.map +1 -0
- package/dist/bridges/gnn-bridge.js +423 -0
- package/dist/bridges/gnn-bridge.js.map +1 -0
- package/dist/bridges/hyperbolic-bridge.d.ts +73 -0
- package/dist/bridges/hyperbolic-bridge.d.ts.map +1 -0
- package/dist/bridges/hyperbolic-bridge.js +451 -0
- package/dist/bridges/hyperbolic-bridge.js.map +1 -0
- package/dist/bridges/index.d.ts +10 -0
- package/dist/bridges/index.d.ts.map +1 -0
- package/dist/bridges/index.js +8 -0
- package/dist/bridges/index.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-tools.d.ts +34 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +740 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/types.d.ts +1013 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +199 -0
- package/dist/types.js.map +1 -0
- package/package.json +101 -0
package/README.md
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# @claude-flow/plugin-hyperbolic-reasoning
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@claude-flow/plugin-hyperbolic-reasoning)
|
|
4
|
+
[](https://github.com/ruvnet/claude-flow/blob/main/LICENSE)
|
|
5
|
+
[](https://www.npmjs.com/package/@claude-flow/plugin-hyperbolic-reasoning)
|
|
6
|
+
|
|
7
|
+
An exotic reasoning plugin implementing hyperbolic neural networks for superior hierarchical understanding. The plugin enables efficient representation of tree structures, taxonomic reasoning, and hierarchical entailment using Poincare ball embeddings with Mobius operations. Applications include improved ontology navigation, hierarchical code understanding, and organizational relationship modeling.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
### npm
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @claude-flow/plugin-hyperbolic-reasoning
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### CLI
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx claude-flow plugins install --name @claude-flow/plugin-hyperbolic-reasoning
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { HyperbolicReasoningPlugin } from '@claude-flow/plugin-hyperbolic-reasoning';
|
|
27
|
+
|
|
28
|
+
// Initialize the plugin
|
|
29
|
+
const plugin = new HyperbolicReasoningPlugin();
|
|
30
|
+
await plugin.initialize();
|
|
31
|
+
|
|
32
|
+
// Embed a file system hierarchy in hyperbolic space
|
|
33
|
+
const embedding = await plugin.embedHierarchy({
|
|
34
|
+
hierarchy: {
|
|
35
|
+
nodes: [
|
|
36
|
+
{ id: 'src', parent: null, features: { type: 'directory' } },
|
|
37
|
+
{ id: 'src/components', parent: 'src', features: { type: 'directory' } },
|
|
38
|
+
{ id: 'src/components/Button.tsx', parent: 'src/components', features: { type: 'file' } },
|
|
39
|
+
{ id: 'src/components/Modal.tsx', parent: 'src/components', features: { type: 'file' } },
|
|
40
|
+
{ id: 'src/utils', parent: 'src', features: { type: 'directory' } }
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
model: 'poincare_ball',
|
|
44
|
+
parameters: {
|
|
45
|
+
dimensions: 32,
|
|
46
|
+
curvature: -1.0,
|
|
47
|
+
learnCurvature: true
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
console.log('Hierarchy embedded in hyperbolic space');
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Available MCP Tools
|
|
55
|
+
|
|
56
|
+
### 1. `hyperbolic/embed-hierarchy`
|
|
57
|
+
|
|
58
|
+
Embed hierarchical data in hyperbolic space (Poincare ball).
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
const result = await mcp.call('hyperbolic/embed-hierarchy', {
|
|
62
|
+
hierarchy: {
|
|
63
|
+
nodes: [
|
|
64
|
+
{ id: 'Animal', parent: null, features: {} },
|
|
65
|
+
{ id: 'Mammal', parent: 'Animal', features: {} },
|
|
66
|
+
{ id: 'Dog', parent: 'Mammal', features: {} },
|
|
67
|
+
{ id: 'Cat', parent: 'Mammal', features: {} },
|
|
68
|
+
{ id: 'Bird', parent: 'Animal', features: {} }
|
|
69
|
+
],
|
|
70
|
+
edges: []
|
|
71
|
+
},
|
|
72
|
+
model: 'poincare_ball',
|
|
73
|
+
parameters: {
|
|
74
|
+
dimensions: 32,
|
|
75
|
+
curvature: -1.0,
|
|
76
|
+
learnCurvature: true
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Models:** `poincare_ball`, `lorentz`, `klein`, `half_plane`
|
|
82
|
+
|
|
83
|
+
**Returns:** Hyperbolic embeddings with learned curvature and embedding quality metrics.
|
|
84
|
+
|
|
85
|
+
### 2. `hyperbolic/taxonomic-reason`
|
|
86
|
+
|
|
87
|
+
Perform taxonomic reasoning using hyperbolic entailment.
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
const result = await mcp.call('hyperbolic/taxonomic-reason', {
|
|
91
|
+
query: {
|
|
92
|
+
type: 'is_a',
|
|
93
|
+
subject: 'Dog',
|
|
94
|
+
object: 'Mammal'
|
|
95
|
+
},
|
|
96
|
+
taxonomy: 'animal-taxonomy',
|
|
97
|
+
inference: {
|
|
98
|
+
transitive: true,
|
|
99
|
+
fuzzy: false,
|
|
100
|
+
confidence: 0.8
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Query Types:** `is_a`, `subsumption`, `lowest_common_ancestor`, `path`, `similarity`
|
|
106
|
+
|
|
107
|
+
**Returns:** Reasoning result with confidence score and inference path.
|
|
108
|
+
|
|
109
|
+
### 3. `hyperbolic/semantic-search`
|
|
110
|
+
|
|
111
|
+
Hierarchically-aware semantic search in hyperbolic space.
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
const result = await mcp.call('hyperbolic/semantic-search', {
|
|
115
|
+
query: 'authentication middleware',
|
|
116
|
+
index: 'codebase-hierarchy',
|
|
117
|
+
searchMode: 'subtree',
|
|
118
|
+
constraints: {
|
|
119
|
+
maxDepth: 5,
|
|
120
|
+
minDepth: 0,
|
|
121
|
+
subtreeRoot: 'src/middleware'
|
|
122
|
+
},
|
|
123
|
+
topK: 10
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Search Modes:** `nearest`, `subtree`, `ancestors`, `siblings`, `cone`
|
|
128
|
+
|
|
129
|
+
**Returns:** Ranked results with hierarchical context and similarity scores.
|
|
130
|
+
|
|
131
|
+
### 4. `hyperbolic/hierarchy-compare`
|
|
132
|
+
|
|
133
|
+
Compare hierarchical structures using hyperbolic alignment.
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
const result = await mcp.call('hyperbolic/hierarchy-compare', {
|
|
137
|
+
source: sourceHierarchy,
|
|
138
|
+
target: targetHierarchy,
|
|
139
|
+
alignment: 'gromov_wasserstein',
|
|
140
|
+
metrics: ['structural_similarity', 'semantic_similarity', 'coverage']
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Alignments:** `wasserstein`, `gromov_wasserstein`, `tree_edit`, `subtree_isomorphism`
|
|
145
|
+
|
|
146
|
+
**Returns:** Alignment mapping with similarity metrics and structural correspondences.
|
|
147
|
+
|
|
148
|
+
### 5. `hyperbolic/entailment-graph`
|
|
149
|
+
|
|
150
|
+
Build and query entailment graphs using hyperbolic embeddings.
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
const result = await mcp.call('hyperbolic/entailment-graph', {
|
|
154
|
+
action: 'build',
|
|
155
|
+
concepts: [
|
|
156
|
+
{ id: 'error', text: 'An error occurred', type: 'event' },
|
|
157
|
+
{ id: 'network_error', text: 'Network connection failed', type: 'event' },
|
|
158
|
+
{ id: 'timeout', text: 'Request timed out', type: 'event' }
|
|
159
|
+
],
|
|
160
|
+
entailmentThreshold: 0.7,
|
|
161
|
+
transitiveClosure: true,
|
|
162
|
+
pruneStrategy: 'transitive_reduction'
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Actions:** `build`, `query`, `expand`, `prune`
|
|
167
|
+
|
|
168
|
+
**Returns:** Entailment graph with directed edges indicating semantic entailment relationships.
|
|
169
|
+
|
|
170
|
+
## Configuration Options
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
interface HyperbolicReasoningConfig {
|
|
174
|
+
// Maximum nodes in hierarchy (default: 1000000)
|
|
175
|
+
maxNodes: number;
|
|
176
|
+
|
|
177
|
+
// Maximum edges (default: 10000000)
|
|
178
|
+
maxEdges: number;
|
|
179
|
+
|
|
180
|
+
// Embedding dimensions (default: 32)
|
|
181
|
+
dimensions: number;
|
|
182
|
+
|
|
183
|
+
// Default curvature (default: -1.0)
|
|
184
|
+
curvature: number;
|
|
185
|
+
|
|
186
|
+
// Memory limit in bytes (default: 2GB)
|
|
187
|
+
memoryLimit: number;
|
|
188
|
+
|
|
189
|
+
// CPU time limit for embedding (default: 300s)
|
|
190
|
+
embeddingTimeout: number;
|
|
191
|
+
|
|
192
|
+
// Numerical stability epsilon (default: 1e-10)
|
|
193
|
+
boundaryEpsilon: number;
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Hyperbolic Geometry Benefits
|
|
198
|
+
|
|
199
|
+
| Property | Euclidean | Hyperbolic |
|
|
200
|
+
|----------|-----------|------------|
|
|
201
|
+
| Tree capacity | O(n^d) | O(exp(d)) |
|
|
202
|
+
| Hierarchy distortion | High | Low |
|
|
203
|
+
| Dimensions needed | Many | Few |
|
|
204
|
+
| Parent-child relationship | No natural representation | Radial distance |
|
|
205
|
+
| Sibling relationship | No natural representation | Angular distance |
|
|
206
|
+
|
|
207
|
+
**Dimension Efficiency:** 32-dim hyperbolic embeddings match the quality of 512-dim Euclidean embeddings for hierarchical data (16x memory reduction).
|
|
208
|
+
|
|
209
|
+
## Performance Targets
|
|
210
|
+
|
|
211
|
+
| Metric | Target | Improvement vs Euclidean |
|
|
212
|
+
|--------|--------|-------------------------|
|
|
213
|
+
| Embedding (10K nodes) | <10s | 3x faster |
|
|
214
|
+
| Hyperbolic search (1M embeddings) | <5ms | 10x faster |
|
|
215
|
+
| Taxonomic query | <10ms | 10x faster than graph traversal |
|
|
216
|
+
| Hierarchy comparison (10K nodes) | <1s | 30x faster than tree edit distance |
|
|
217
|
+
| Entailment graph (100K concepts) | <30s | 20x faster than pairwise |
|
|
218
|
+
| Memory efficiency | 32-dim | 16x less than 512-dim Euclidean |
|
|
219
|
+
|
|
220
|
+
## Security Considerations
|
|
221
|
+
|
|
222
|
+
- **Numerical Stability**: Vectors are clipped to stay within Poincare ball boundary (1 - epsilon)
|
|
223
|
+
- **Input Validation**: All inputs validated with Zod schemas; hierarchies validated for cycles, excessive depth (max 100), and excessive branching
|
|
224
|
+
- **Output Validation**: All hyperbolic outputs validated for numerical sanity (finite values, within ball)
|
|
225
|
+
- **DoS Prevention**: Limits on node count (1M), edge count (10M), and embedding timeout (300s)
|
|
226
|
+
- **Curvature Bounds**: Curvature restricted to range [-10, -0.01] to prevent numerical issues
|
|
227
|
+
- **Cycle Detection**: DAG validation prevents infinite loops in hierarchy traversal
|
|
228
|
+
|
|
229
|
+
### WASM Security Constraints
|
|
230
|
+
|
|
231
|
+
| Constraint | Value | Rationale |
|
|
232
|
+
|------------|-------|-----------|
|
|
233
|
+
| Memory Limit | 2GB max | Handle large hierarchies |
|
|
234
|
+
| CPU Time Limit | 300 seconds | Allow complex embedding operations |
|
|
235
|
+
| No Network Access | Enforced | Prevent data exfiltration |
|
|
236
|
+
| Numerical Epsilon | 1e-10 | Prevent boundary violations |
|
|
237
|
+
| Output Validation | All vectors checked | Ensure numerical stability |
|
|
238
|
+
|
|
239
|
+
### Input Limits
|
|
240
|
+
|
|
241
|
+
| Constraint | Limit |
|
|
242
|
+
|------------|-------|
|
|
243
|
+
| Max nodes | 1,000,000 |
|
|
244
|
+
| Max edges | 10,000,000 |
|
|
245
|
+
| Max dimensions | 512 |
|
|
246
|
+
| Max hierarchy depth | 100 |
|
|
247
|
+
| Max branching factor | 10,000 |
|
|
248
|
+
| CPU time for embedding | 300 seconds |
|
|
249
|
+
| Memory limit | 2GB |
|
|
250
|
+
|
|
251
|
+
### Rate Limits
|
|
252
|
+
|
|
253
|
+
| Tool | Requests/Minute | Max Concurrent |
|
|
254
|
+
|------|-----------------|----------------|
|
|
255
|
+
| `embed-hierarchy` | 5 | 1 |
|
|
256
|
+
| `taxonomic-reason` | 60 | 5 |
|
|
257
|
+
| `semantic-search` | 60 | 5 |
|
|
258
|
+
| `hierarchy-compare` | 10 | 2 |
|
|
259
|
+
| `entailment-graph` | 10 | 2 |
|
|
260
|
+
|
|
261
|
+
## Dependencies
|
|
262
|
+
|
|
263
|
+
- `ruvector-hyperbolic-hnsw-wasm` - Hyperbolic nearest neighbor search
|
|
264
|
+
- `ruvector-attention-wasm` - Hyperbolic attention mechanisms
|
|
265
|
+
- `ruvector-gnn-wasm` - Hyperbolic graph neural networks
|
|
266
|
+
- `micro-hnsw-wasm` - Tangent space approximation search
|
|
267
|
+
- `sona` - Adaptive curvature learning
|
|
268
|
+
|
|
269
|
+
## Mobius Operations
|
|
270
|
+
|
|
271
|
+
The plugin implements core Mobius operations for the Poincare ball:
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
// Mobius addition: x + y in hyperbolic space
|
|
275
|
+
mobius_add(x: Vector, y: Vector, c: number): Vector
|
|
276
|
+
|
|
277
|
+
// Mobius scalar multiplication
|
|
278
|
+
mobius_scalar(r: number, x: Vector, c: number): Vector
|
|
279
|
+
|
|
280
|
+
// Exponential map: tangent space -> hyperbolic
|
|
281
|
+
exp_map(v: Vector, c: number): Vector
|
|
282
|
+
|
|
283
|
+
// Logarithmic map: hyperbolic -> tangent space
|
|
284
|
+
log_map(x: Vector, c: number): Vector
|
|
285
|
+
|
|
286
|
+
// Hyperbolic distance
|
|
287
|
+
hyperbolic_distance(x: Vector, y: Vector, c: number): number
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Curvature Learning
|
|
291
|
+
|
|
292
|
+
The plugin supports learning optimal curvature per hierarchy:
|
|
293
|
+
|
|
294
|
+
| Hierarchy Type | Typical Curvature |
|
|
295
|
+
|----------------|-------------------|
|
|
296
|
+
| Flat hierarchy (organization chart) | Low curvature (-0.1) |
|
|
297
|
+
| Deep hierarchy (taxonomy) | High curvature (-2.0) |
|
|
298
|
+
| Mixed hierarchy | Adaptive via SONA |
|
|
299
|
+
|
|
300
|
+
## Use Cases
|
|
301
|
+
|
|
302
|
+
1. **Ontology Navigation**: Efficiently traverse and query large knowledge graphs
|
|
303
|
+
2. **Code Hierarchy Understanding**: Model inheritance, module structure, and dependencies
|
|
304
|
+
3. **Organizational Analysis**: Understand reporting structures and influence networks
|
|
305
|
+
4. **Taxonomic Classification**: Improved classification with hierarchical awareness
|
|
306
|
+
5. **Concept Entailment**: Determine semantic relationships between concepts
|
|
307
|
+
|
|
308
|
+
## Related Plugins
|
|
309
|
+
|
|
310
|
+
| Plugin | Description | Synergy |
|
|
311
|
+
|--------|-------------|---------|
|
|
312
|
+
| [@claude-flow/plugin-neural-coordination](https://www.npmjs.com/package/@claude-flow/plugin-neural-coordination) | Multi-agent coordination | Hierarchical embeddings enable efficient agent organization structures |
|
|
313
|
+
| [@claude-flow/plugin-cognitive-kernel](https://www.npmjs.com/package/@claude-flow/plugin-cognitive-kernel) | Cognitive augmentation | Hyperbolic memory organization for improved episodic retrieval |
|
|
314
|
+
| [@claude-flow/plugin-quantum-optimizer](https://www.npmjs.com/package/@claude-flow/plugin-quantum-optimizer) | Quantum-inspired optimization | Optimizes hierarchical constraint satisfaction and tree operations |
|
|
315
|
+
|
|
316
|
+
## License
|
|
317
|
+
|
|
318
|
+
MIT
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GNN Bridge - Graph Neural Network Operations
|
|
3
|
+
*
|
|
4
|
+
* Bridge to @ruvector/gnn-wasm for graph-based reasoning,
|
|
5
|
+
* node classification, link prediction, and graph embeddings.
|
|
6
|
+
*/
|
|
7
|
+
import type { Concept, EntailmentGraph } from '../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* WASM module status
|
|
10
|
+
*/
|
|
11
|
+
export type WasmModuleStatus = 'unloaded' | 'loading' | 'ready' | 'error';
|
|
12
|
+
/**
|
|
13
|
+
* GNN configuration
|
|
14
|
+
*/
|
|
15
|
+
export interface GnnConfig {
|
|
16
|
+
/** Input feature dimension */
|
|
17
|
+
readonly inputDim: number;
|
|
18
|
+
/** Hidden layer dimension */
|
|
19
|
+
readonly hiddenDim: number;
|
|
20
|
+
/** Output dimension */
|
|
21
|
+
readonly outputDim: number;
|
|
22
|
+
/** Number of GNN layers */
|
|
23
|
+
readonly numLayers: number;
|
|
24
|
+
/** Aggregation method */
|
|
25
|
+
readonly aggregation: 'mean' | 'sum' | 'max' | 'attention';
|
|
26
|
+
/** Dropout rate */
|
|
27
|
+
readonly dropout: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Graph structure for GNN
|
|
31
|
+
*/
|
|
32
|
+
export interface Graph {
|
|
33
|
+
/** Node features (each node has a feature vector) */
|
|
34
|
+
readonly nodeFeatures: Float32Array[];
|
|
35
|
+
/** Edges as [source, target] pairs */
|
|
36
|
+
readonly edges: Array<[number, number]>;
|
|
37
|
+
/** Edge weights */
|
|
38
|
+
readonly edgeWeights?: Float32Array;
|
|
39
|
+
/** Node labels (for supervised learning) */
|
|
40
|
+
readonly labels?: Uint32Array;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* GNN inference result
|
|
44
|
+
*/
|
|
45
|
+
export interface GnnResult {
|
|
46
|
+
/** Node embeddings */
|
|
47
|
+
readonly nodeEmbeddings: Float32Array[];
|
|
48
|
+
/** Graph-level embedding */
|
|
49
|
+
readonly graphEmbedding: Float32Array;
|
|
50
|
+
/** Node predictions (if applicable) */
|
|
51
|
+
readonly predictions?: Float32Array[];
|
|
52
|
+
/** Attention weights (if using attention aggregation) */
|
|
53
|
+
readonly attentionWeights?: Map<string, Float32Array>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Entailment prediction result
|
|
57
|
+
*/
|
|
58
|
+
export interface EntailmentPrediction {
|
|
59
|
+
/** Premise concept ID */
|
|
60
|
+
readonly premise: string;
|
|
61
|
+
/** Hypothesis concept ID */
|
|
62
|
+
readonly hypothesis: string;
|
|
63
|
+
/** Probability of entailment */
|
|
64
|
+
readonly entailmentProb: number;
|
|
65
|
+
/** Probability of contradiction */
|
|
66
|
+
readonly contradictionProb: number;
|
|
67
|
+
/** Probability of neutral */
|
|
68
|
+
readonly neutralProb: number;
|
|
69
|
+
/** Final relation type */
|
|
70
|
+
readonly relation: 'entails' | 'contradicts' | 'neutral';
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Graph Neural Network Bridge
|
|
74
|
+
*/
|
|
75
|
+
export declare class GnnBridge {
|
|
76
|
+
readonly name = "hyperbolic-gnn-bridge";
|
|
77
|
+
readonly version = "0.1.0";
|
|
78
|
+
private _status;
|
|
79
|
+
private _module;
|
|
80
|
+
private _config;
|
|
81
|
+
constructor(config?: Partial<GnnConfig>);
|
|
82
|
+
get status(): WasmModuleStatus;
|
|
83
|
+
get initialized(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Initialize the WASM module
|
|
86
|
+
*/
|
|
87
|
+
initialize(): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Dispose of resources
|
|
90
|
+
*/
|
|
91
|
+
dispose(): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Forward pass through GNN
|
|
94
|
+
*/
|
|
95
|
+
forward(graph: Graph, config?: Partial<GnnConfig>): GnnResult;
|
|
96
|
+
/**
|
|
97
|
+
* Predict links between nodes
|
|
98
|
+
*/
|
|
99
|
+
predictLinks(graph: Graph, sourceNodes: number[], targetNodes: number[]): Float32Array;
|
|
100
|
+
/**
|
|
101
|
+
* Build entailment graph from concepts using GNN
|
|
102
|
+
*/
|
|
103
|
+
buildEntailmentGraph(concepts: ReadonlyArray<Concept>, threshold?: number): Promise<EntailmentGraph>;
|
|
104
|
+
/**
|
|
105
|
+
* Predict entailment between two concepts
|
|
106
|
+
*/
|
|
107
|
+
predictEntailment(premiseEmb: Float32Array, hypothesisEmb: Float32Array): EntailmentPrediction;
|
|
108
|
+
/**
|
|
109
|
+
* Compute transitive closure of entailment graph
|
|
110
|
+
*/
|
|
111
|
+
computeTransitiveClosure(graph: EntailmentGraph): EntailmentGraph;
|
|
112
|
+
/**
|
|
113
|
+
* Prune entailment graph using transitive reduction
|
|
114
|
+
*/
|
|
115
|
+
transitiveReduction(graph: EntailmentGraph): EntailmentGraph;
|
|
116
|
+
private computeEntailmentScore;
|
|
117
|
+
private computeMaxDepth;
|
|
118
|
+
/**
|
|
119
|
+
* Create mock module for development
|
|
120
|
+
*/
|
|
121
|
+
private createMockModule;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Create a new GnnBridge instance
|
|
125
|
+
*/
|
|
126
|
+
export declare function createGnnBridge(config?: Partial<GnnConfig>): GnnBridge;
|
|
127
|
+
//# sourceMappingURL=gnn-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gnn-bridge.d.ts","sourceRoot":"","sources":["../../src/bridges/gnn-bridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAIV,OAAO,EAEP,eAAe,EAChB,MAAM,a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