dress-graph 0.5.2 → 0.6.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **A Continuous Framework for Structural Graph Refinement**
4
4
 
5
- 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
+ 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, guaranteed bitwise-equal across any vertex labeling, 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.
6
6
 
7
7
  ## Quick start
8
8
 
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 DressGraphOptions {
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 DressGraph {
71
+ export declare class DRESS {
72
72
  private constructor();
73
- static create(opts: DressGraphOptions): Promise<DressGraph>;
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
@@ -154,14 +154,15 @@ export async function dressFit(opts) {
154
154
  // offset 20: *adj_offset (ptr32)
155
155
  // offset 24: *adj_target (ptr32)
156
156
  // offset 28: *adj_edge_idx (ptr32)
157
- // offset 32: *W (ptr32) raw input weights
158
- // offset 36: *edge_weight (ptr32)
159
- // offset 40: *edge_dress (ptr32)
160
- // offset 44: *edge_dress_next (ptr32)
161
- // offset 48: *node_dress (ptr32)
162
- const ewPtr = M.getValue(g + 36, 'i32'); // edge_weight pointer
163
- const edPtr = M.getValue(g + 40, 'i32'); // edge_dress pointer
164
- const ndPtr = M.getValue(g + 48, 'i32'); // node_dress pointer
157
+ // offset 32: max_degree (i32)
158
+ // offset 36: *W (ptr32) raw input weights
159
+ // offset 40: *edge_weight (ptr32)
160
+ // offset 48: *edge_dress (ptr32)
161
+ // offset 52: *edge_dress_next (ptr32)
162
+ // offset 56: *node_dress (ptr32)
163
+ const ewPtr = M.getValue(g + 44, 'i32'); // edge_weight pointer
164
+ const edPtr = M.getValue(g + 48, 'i32'); // edge_dress pointer
165
+ const ndPtr = M.getValue(g + 56, 'i32'); // node_dress pointer
165
166
 
166
167
  // Copy results into JS-owned typed arrays
167
168
  const edgeWeight = new Float64Array(E);
@@ -201,13 +202,13 @@ export async function dressFit(opts) {
201
202
  };
202
203
  }
203
204
 
204
- // ── Persistent DressGraph class ─────────────────────────────────────
205
+ // ── Persistent DRESS class ──────────────────────────────────────────
205
206
 
206
207
  /**
207
208
  * A persistent DRESS graph that supports repeated fit and get calls.
208
209
  *
209
210
  * Usage:
210
- * const g = await DressGraph.create({
211
+ * const g = await DRESS.create({
211
212
  * numVertices: 4,
212
213
  * sources: [0,1,2,0],
213
214
  * targets: [1,2,3,3],
@@ -217,7 +218,7 @@ export async function dressFit(opts) {
217
218
  * const res = g.result(); // snapshot of current results
218
219
  * g.free(); // explicitly free C graph
219
220
  */
220
- export class DressGraph {
221
+ export class DRESS {
221
222
  /** @private */
222
223
  constructor(module, gPtr, n, e, sources, targets) {
223
224
  this._M = module;
@@ -231,7 +232,7 @@ export class DressGraph {
231
232
  }
232
233
 
233
234
  /**
234
- * Create a persistent DressGraph.
235
+ * Create a persistent DRESS graph.
235
236
  *
236
237
  * @param {Object} opts
237
238
  * @param {number} opts.numVertices
@@ -240,7 +241,7 @@ export class DressGraph {
240
241
  * @param {Float64Array|number[]|null} [opts.weights]
241
242
  * @param {number} [opts.variant=0]
242
243
  * @param {boolean} [opts.precomputeIntercepts=false]
243
- * @returns {Promise<DressGraph>}
244
+ * @returns {Promise<DRESS>}
244
245
  */
245
246
  static async create(opts) {
246
247
  const M = await getModule();
@@ -272,7 +273,7 @@ export class DressGraph {
272
273
  const g = M._init_dress_graph(N, E, uPtr, vPtr, wPtr, variant, precompute);
273
274
  if (g === 0) throw new Error('init_dress_graph returned NULL');
274
275
 
275
- return new DressGraph(M, g, N, E, opts.sources, opts.targets);
276
+ return new DRESS(M, g, N, E, opts.sources, opts.targets);
276
277
  }
277
278
 
278
279
  /**
@@ -282,7 +283,7 @@ export class DressGraph {
282
283
  * @returns {{iterations: number, delta: number}}
283
284
  */
284
285
  fit(maxIterations = 100, epsilon = 1e-6) {
285
- if (!this._g) throw new Error('DressGraph already freed');
286
+ if (!this._g) throw new Error('DRESS already freed');
286
287
  const M = this._M;
287
288
  M._dress_fit(this._g, maxIterations, epsilon, this._iterPtr, this._deltaPtr);
288
289
  return {
@@ -301,7 +302,7 @@ export class DressGraph {
301
302
  * @returns {number}
302
303
  */
303
304
  get(u, v, maxIterations = 100, epsilon = 1e-6, edgeWeight = 1.0) {
304
- if (!this._g) throw new Error('DressGraph already freed');
305
+ if (!this._g) throw new Error('DRESS already freed');
305
306
  return this._M._dress_get(this._g, u, v, maxIterations, epsilon, edgeWeight);
306
307
  }
307
308
 
@@ -310,15 +311,15 @@ export class DressGraph {
310
311
  * @returns {DressResult}
311
312
  */
312
313
  result() {
313
- if (!this._g) throw new Error('DressGraph already freed');
314
+ if (!this._g) throw new Error('DRESS already freed');
314
315
  const M = this._M;
315
316
  const E = this._e;
316
317
  const N = this._n;
317
318
 
318
319
  // WASM32 offsets
319
- const ewPtr = M.getValue(this._g + 36, 'i32');
320
- const edPtr = M.getValue(this._g + 40, 'i32');
321
- const ndPtr = M.getValue(this._g + 48, 'i32');
320
+ const ewPtr = M.getValue(this._g + 44, 'i32');
321
+ const edPtr = M.getValue(this._g + 48, 'i32');
322
+ const ndPtr = M.getValue(this._g + 56, 'i32');
322
323
 
323
324
  const edgeWeight = new Float64Array(E);
324
325
  const edgeDress = new Float64Array(E);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dress-graph",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
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",