@thi.ng/adjacency 2.5.5 → 2.5.8
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/CHANGELOG.md +1 -1
- package/README.md +1 -1
- package/bfs.js +4 -0
- package/binary.js +3 -0
- package/dfs.js +4 -0
- package/disjoint-set.js +3 -0
- package/floyd-warshall.js +3 -0
- package/list.js +4 -4
- package/package.json +14 -15
- package/sparse.js +1 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/bfs.js
CHANGED
|
@@ -13,6 +13,10 @@ import { DCons } from "@thi.ng/dcons/dcons";
|
|
|
13
13
|
* - https://algs4.cs.princeton.edu/40graphs/
|
|
14
14
|
*/
|
|
15
15
|
export class BFS {
|
|
16
|
+
graph;
|
|
17
|
+
marked;
|
|
18
|
+
edges;
|
|
19
|
+
dist;
|
|
16
20
|
constructor(graph, src, cost = () => 1) {
|
|
17
21
|
this.graph = graph;
|
|
18
22
|
const numV = graph.numVertices();
|
package/binary.js
CHANGED
|
@@ -7,6 +7,9 @@ import { __into, __invert, __toDot } from "./utils.js";
|
|
|
7
7
|
* storing 16384 directed edges in just 2KB of memory (128 * 128 / 8 = 2048).
|
|
8
8
|
*/
|
|
9
9
|
export class AdjacencyBitMatrix {
|
|
10
|
+
mat;
|
|
11
|
+
undirected;
|
|
12
|
+
numE;
|
|
10
13
|
constructor(n, edges, undirected = false) {
|
|
11
14
|
this.mat = new BitMatrix(n);
|
|
12
15
|
this.undirected = undirected;
|
package/dfs.js
CHANGED
package/disjoint-set.js
CHANGED
package/floyd-warshall.js
CHANGED
|
@@ -20,6 +20,9 @@ import { outOfBounds } from "@thi.ng/errors/out-of-bounds";
|
|
|
20
20
|
* - https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm
|
|
21
21
|
*/
|
|
22
22
|
export class FloydWarshall {
|
|
23
|
+
dist;
|
|
24
|
+
next;
|
|
25
|
+
numV;
|
|
23
26
|
/**
|
|
24
27
|
* Instantiates and pre-computes all shortest paths in given `graph`. See
|
|
25
28
|
* class comments for details.
|
package/list.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __into, __invert, __toDot } from "./utils.js";
|
|
2
2
|
export class AdjacencyList {
|
|
3
|
+
adjacency = [];
|
|
4
|
+
indegree = [];
|
|
5
|
+
numE = 0;
|
|
6
|
+
numV = 0;
|
|
3
7
|
constructor(edges) {
|
|
4
|
-
this.adjacency = [];
|
|
5
|
-
this.indegree = [];
|
|
6
|
-
this.numE = 0;
|
|
7
|
-
this.numV = 0;
|
|
8
8
|
edges && __into(this, edges);
|
|
9
9
|
}
|
|
10
10
|
numEdges() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/adjacency",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.8",
|
|
4
4
|
"description": "Sparse & bitwise adjacency matrices, lists and selected traversal algorithms for directed & undirected graphs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -31,26 +31,25 @@
|
|
|
31
31
|
"clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc",
|
|
32
32
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
33
33
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
34
|
-
"doc:readme": "
|
|
35
|
-
"doc:stats": "tools:module-stats",
|
|
34
|
+
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
36
35
|
"pub": "yarn npm publish --access public",
|
|
37
|
-
"test": "
|
|
36
|
+
"test": "bun test"
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"@thi.ng/api": "^8.9.
|
|
41
|
-
"@thi.ng/arrays": "^2.7.
|
|
42
|
-
"@thi.ng/bitfield": "^2.3.
|
|
43
|
-
"@thi.ng/dcons": "^3.2.
|
|
44
|
-
"@thi.ng/errors": "^2.4.
|
|
45
|
-
"@thi.ng/sparse": "^0.3.
|
|
39
|
+
"@thi.ng/api": "^8.9.8",
|
|
40
|
+
"@thi.ng/arrays": "^2.7.4",
|
|
41
|
+
"@thi.ng/bitfield": "^2.3.6",
|
|
42
|
+
"@thi.ng/dcons": "^3.2.72",
|
|
43
|
+
"@thi.ng/errors": "^2.4.2",
|
|
44
|
+
"@thi.ng/sparse": "^0.3.77"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"@microsoft/api-extractor": "^7.38.
|
|
49
|
-
"@thi.ng/testament": "^0.
|
|
50
|
-
"@thi.ng/vectors": "^7.8.
|
|
47
|
+
"@microsoft/api-extractor": "^7.38.2",
|
|
48
|
+
"@thi.ng/testament": "^0.4.1",
|
|
49
|
+
"@thi.ng/vectors": "^7.8.4",
|
|
51
50
|
"rimraf": "^5.0.5",
|
|
52
51
|
"tools": "^0.0.1",
|
|
53
|
-
"typedoc": "^0.25.
|
|
52
|
+
"typedoc": "^0.25.3",
|
|
54
53
|
"typescript": "^5.2.2"
|
|
55
54
|
},
|
|
56
55
|
"keywords": [
|
|
@@ -125,5 +124,5 @@
|
|
|
125
124
|
],
|
|
126
125
|
"year": 2018
|
|
127
126
|
},
|
|
128
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "669a3151e4302480244fe3e60eff5e732ea5b7a7\n"
|
|
129
128
|
}
|
package/sparse.js
CHANGED
|
@@ -2,6 +2,7 @@ import { ensureIndex2 } from "@thi.ng/errors/out-of-bounds";
|
|
|
2
2
|
import { CSR } from "@thi.ng/sparse/csr";
|
|
3
3
|
import { __into, __invert, __toDot } from "./utils.js";
|
|
4
4
|
export class AdjacencyMatrix extends CSR {
|
|
5
|
+
undirected;
|
|
5
6
|
constructor(n, data, rows, cols, undirected = false) {
|
|
6
7
|
super(n, n, data, rows, cols);
|
|
7
8
|
this.undirected = undirected;
|