graphology-indices
Advanced tools
Comparing version 0.16.4 to 0.16.5
@@ -1,7 +0,9 @@ | ||
export default class DFSStack { | ||
export default class DFSStack<T = string> { | ||
size: number; | ||
seen: Set<string>; | ||
constructor(order: number); | ||
has(node: string): boolean; | ||
push(node: string): boolean; | ||
pop(): string | undefined; | ||
pushWith(node: string, item: T): boolean; | ||
pop(): T | undefined; | ||
} |
/** | ||
* Graphology DFS Stack. | ||
* ====================== | ||
* Graphology DFS Stack | ||
* ===================== | ||
* | ||
@@ -32,2 +32,15 @@ * An experiment to speed up DFS in graphs and connected component detection. | ||
DFSStack.prototype.pushWith = function (node, item) { | ||
var seenSizeBefore = this.seen.size; | ||
this.seen.add(node); | ||
// If node was already seen | ||
if (seenSizeBefore === this.seen.size) return false; | ||
this.stack[this.size++] = item; | ||
return true; | ||
}; | ||
DFSStack.prototype.pop = function () { | ||
@@ -34,0 +47,0 @@ if (this.size === 0) return; |
@@ -0,1 +1,2 @@ | ||
export {default as BFSQueue} from './bfs-queue'; | ||
export {default as DFSStack} from './dfs-stack'; | ||
@@ -2,0 +3,0 @@ export {UndirectedLouvainIndex, DirectedLouvainIndex} from './louvain'; |
@@ -10,2 +10,3 @@ /** | ||
exports.BFSQueue = require('./bfs-queue.js'); | ||
exports.DFSStack = require('./dfs-stack.js'); | ||
@@ -12,0 +13,0 @@ exports.UndirectedLouvainIndex = louvain.UndirectedLouvainIndex; |
{ | ||
"name": "graphology-indices", | ||
"version": "0.16.4", | ||
"version": "0.16.5", | ||
"description": "Miscellaneous indices for graphology.", | ||
@@ -8,2 +8,3 @@ "main": "index.js", | ||
"*.d.ts", | ||
"bfs-queue.js", | ||
"dfs-stack.js", | ||
@@ -42,4 +43,4 @@ "index.js", | ||
"graphology-utils": "^2.4.2", | ||
"mnemonist": "^0.38.0" | ||
"mnemonist": "^0.39.0" | ||
} | ||
} |
@@ -21,1 +21,2 @@ # Graphology Indices | ||
- A specialized stack/set that can be used to perform memory-efficient DFS traversals. | ||
- A specialized queue/set that can be used to perform memory-efficient BFS traversals. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43304
15
1213
22
+ Addedmnemonist@0.39.8(transitive)
- Removedmnemonist@0.38.5(transitive)
Updatedmnemonist@^0.39.0