@graphty/algorithms 1.8.0 → 2.0.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.
Files changed (43) hide show
  1. package/README.md +5 -4
  2. package/dist/algorithms.js +518 -525
  3. package/dist/algorithms.js.map +1 -1
  4. package/dist/algorithms.standalone.js +519 -526
  5. package/dist/algorithms.standalone.js.map +1 -1
  6. package/dist/src/algorithms/centrality/eigenvector.d.ts +13 -2
  7. package/dist/src/algorithms/centrality/eigenvector.d.ts.map +1 -1
  8. package/dist/src/algorithms/centrality/eigenvector.js +96 -73
  9. package/dist/src/algorithms/centrality/eigenvector.js.map +1 -1
  10. package/dist/src/algorithms/community/girvan-newman.js +35 -15
  11. package/dist/src/algorithms/community/girvan-newman.js.map +1 -1
  12. package/dist/src/algorithms/community/leiden.d.ts.map +1 -1
  13. package/dist/src/algorithms/community/leiden.js +214 -222
  14. package/dist/src/algorithms/community/leiden.js.map +1 -1
  15. package/dist/src/algorithms/community/louvain-optimized.d.ts +28 -72
  16. package/dist/src/algorithms/community/louvain-optimized.d.ts.map +1 -1
  17. package/dist/src/algorithms/community/louvain-optimized.js +249 -262
  18. package/dist/src/algorithms/community/louvain-optimized.js.map +1 -1
  19. package/dist/src/algorithms/community/modularity-utils.d.ts +15 -7
  20. package/dist/src/algorithms/community/modularity-utils.d.ts.map +1 -1
  21. package/dist/src/algorithms/community/modularity-utils.js +38 -38
  22. package/dist/src/algorithms/community/modularity-utils.js.map +1 -1
  23. package/dist/src/algorithms/shortest-path/bellman-ford.d.ts.map +1 -1
  24. package/dist/src/algorithms/shortest-path/bellman-ford.js +35 -8
  25. package/dist/src/algorithms/shortest-path/bellman-ford.js.map +1 -1
  26. package/dist/src/errors.d.ts +21 -0
  27. package/dist/src/errors.d.ts.map +1 -0
  28. package/dist/src/errors.js +23 -0
  29. package/dist/src/errors.js.map +1 -0
  30. package/dist/src/index.d.ts +1 -0
  31. package/dist/src/index.d.ts.map +1 -1
  32. package/dist/src/index.js +2 -0
  33. package/dist/src/index.js.map +1 -1
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +8 -8
  36. package/src/algorithms/centrality/eigenvector.ts +103 -84
  37. package/src/algorithms/community/girvan-newman.ts +38 -17
  38. package/src/algorithms/community/leiden.ts +270 -275
  39. package/src/algorithms/community/louvain-optimized.ts +303 -313
  40. package/src/algorithms/community/modularity-utils.ts +42 -45
  41. package/src/algorithms/shortest-path/bellman-ford.ts +46 -8
  42. package/src/errors.ts +26 -0
  43. package/src/index.ts +3 -0
package/README.md CHANGED
@@ -459,6 +459,9 @@ const centralities = eigenvectorCentrality(graph, {
459
459
  maxIterations: number, // Default: 100
460
460
  tolerance: number, // Default: 1e-6
461
461
  });
462
+ // Throws ConvergenceError (exported) when maxIterations passes do not meet the tolerance,
463
+ // as networkx raises PowerIterationFailedConvergence. Long paths and large grids need more
464
+ // than 100 passes; raise maxIterations or tolerance and call again.
462
465
  // Returns: CentralityResult (Record<string, number>)
463
466
 
464
467
  // Single node eigenvector centrality
@@ -1433,14 +1436,12 @@ The project includes interactive HTML examples demonstrating each algorithm. To
1433
1436
  # HOST=0.0.0.0 # For network access
1434
1437
  # HOST=my.server.com # Custom domain
1435
1438
 
1436
- # Server port (defaults to 9000)
1437
- PORT=9000 # Must be between 9000-9099
1438
1439
  ```
1439
1440
 
1440
- 3. **Start the development server:**
1441
+ 3. **Start the development server** (the port is required and comes from `PORT`):
1441
1442
 
1442
1443
  ```bash
1443
- npm run examples:html
1444
+ PORT=9000 npm run examples:html
1444
1445
  ```
1445
1446
 
1446
1447
  4. **Open your browser** to `http://localhost:9000` (or your configured host/port)