dress-graph 0.5.2 → 0.5.3
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/dress.d.ts +3 -3
- package/dress.js +9 -9
- package/package.json +1 -1
package/dress.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface DressResult {
|
|
|
50
50
|
*/
|
|
51
51
|
export declare function dressFit(opts: DressOptions): Promise<DressResult>;
|
|
52
52
|
|
|
53
|
-
export interface
|
|
53
|
+
export interface DRESSOptions {
|
|
54
54
|
/** Number of vertices (vertex ids must be in 0..numVertices-1) */
|
|
55
55
|
numVertices: number;
|
|
56
56
|
/** Edge source vertices (0-based) */
|
|
@@ -68,9 +68,9 @@ export interface DressGraphOptions {
|
|
|
68
68
|
/**
|
|
69
69
|
* A persistent DRESS graph supporting repeated fit / get calls.
|
|
70
70
|
*/
|
|
71
|
-
export declare class
|
|
71
|
+
export declare class DRESS {
|
|
72
72
|
private constructor();
|
|
73
|
-
static create(opts:
|
|
73
|
+
static create(opts: DRESSOptions): Promise<DRESS>;
|
|
74
74
|
fit(maxIterations?: number, epsilon?: number): { iterations: number; delta: number };
|
|
75
75
|
get(u: number, v: number, maxIterations?: number, epsilon?: number, edgeWeight?: number): number;
|
|
76
76
|
result(): DressResult;
|
package/dress.js
CHANGED
|
@@ -201,13 +201,13 @@ export async function dressFit(opts) {
|
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
// ── Persistent
|
|
204
|
+
// ── Persistent DRESS class ──────────────────────────────────────────
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
207
|
* A persistent DRESS graph that supports repeated fit and get calls.
|
|
208
208
|
*
|
|
209
209
|
* Usage:
|
|
210
|
-
* const g = await
|
|
210
|
+
* const g = await DRESS.create({
|
|
211
211
|
* numVertices: 4,
|
|
212
212
|
* sources: [0,1,2,0],
|
|
213
213
|
* targets: [1,2,3,3],
|
|
@@ -217,7 +217,7 @@ export async function dressFit(opts) {
|
|
|
217
217
|
* const res = g.result(); // snapshot of current results
|
|
218
218
|
* g.free(); // explicitly free C graph
|
|
219
219
|
*/
|
|
220
|
-
export class
|
|
220
|
+
export class DRESS {
|
|
221
221
|
/** @private */
|
|
222
222
|
constructor(module, gPtr, n, e, sources, targets) {
|
|
223
223
|
this._M = module;
|
|
@@ -231,7 +231,7 @@ export class DressGraph {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
|
-
* Create a persistent
|
|
234
|
+
* Create a persistent DRESS graph.
|
|
235
235
|
*
|
|
236
236
|
* @param {Object} opts
|
|
237
237
|
* @param {number} opts.numVertices
|
|
@@ -240,7 +240,7 @@ export class DressGraph {
|
|
|
240
240
|
* @param {Float64Array|number[]|null} [opts.weights]
|
|
241
241
|
* @param {number} [opts.variant=0]
|
|
242
242
|
* @param {boolean} [opts.precomputeIntercepts=false]
|
|
243
|
-
* @returns {Promise<
|
|
243
|
+
* @returns {Promise<DRESS>}
|
|
244
244
|
*/
|
|
245
245
|
static async create(opts) {
|
|
246
246
|
const M = await getModule();
|
|
@@ -272,7 +272,7 @@ export class DressGraph {
|
|
|
272
272
|
const g = M._init_dress_graph(N, E, uPtr, vPtr, wPtr, variant, precompute);
|
|
273
273
|
if (g === 0) throw new Error('init_dress_graph returned NULL');
|
|
274
274
|
|
|
275
|
-
return new
|
|
275
|
+
return new DRESS(M, g, N, E, opts.sources, opts.targets);
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
/**
|
|
@@ -282,7 +282,7 @@ export class DressGraph {
|
|
|
282
282
|
* @returns {{iterations: number, delta: number}}
|
|
283
283
|
*/
|
|
284
284
|
fit(maxIterations = 100, epsilon = 1e-6) {
|
|
285
|
-
if (!this._g) throw new Error('
|
|
285
|
+
if (!this._g) throw new Error('DRESS already freed');
|
|
286
286
|
const M = this._M;
|
|
287
287
|
M._dress_fit(this._g, maxIterations, epsilon, this._iterPtr, this._deltaPtr);
|
|
288
288
|
return {
|
|
@@ -301,7 +301,7 @@ export class DressGraph {
|
|
|
301
301
|
* @returns {number}
|
|
302
302
|
*/
|
|
303
303
|
get(u, v, maxIterations = 100, epsilon = 1e-6, edgeWeight = 1.0) {
|
|
304
|
-
if (!this._g) throw new Error('
|
|
304
|
+
if (!this._g) throw new Error('DRESS already freed');
|
|
305
305
|
return this._M._dress_get(this._g, u, v, maxIterations, epsilon, edgeWeight);
|
|
306
306
|
}
|
|
307
307
|
|
|
@@ -310,7 +310,7 @@ export class DressGraph {
|
|
|
310
310
|
* @returns {DressResult}
|
|
311
311
|
*/
|
|
312
312
|
result() {
|
|
313
|
-
if (!this._g) throw new Error('
|
|
313
|
+
if (!this._g) throw new Error('DRESS already freed');
|
|
314
314
|
const M = this._M;
|
|
315
315
|
const E = this._e;
|
|
316
316
|
const N = this._n;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dress-graph",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "DRESS is a deterministic, parameter-free framework that iteratively refines the structural similarity of edges in a graph to produce a canonical fingerprint: a real-valued edge vector, obtained by converging a non-linear dynamical system to its unique fixed point. The fingerprint is isomorphism-invariant by construction, numerically stable (no overflow, no error amplification, no undefined behavior), fast and embarrassingly parallel to compute: DRESS total runtime is O(I * m * d_max) for I iterations to convergence, and convergence is guaranteed by Birkhoff contraction.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dress.js",
|