Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-graph

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-graph - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

8

lib/index.d.ts

@@ -33,7 +33,7 @@ export declare class Node<T> {

kahnTopologicalSort(): Array<Node<T>>;
bfs(onNode: OnNodeFn<T>): void;
bfsAsync(onNode: OnNodeFnAsync<T>): Promise<void>;
dfs(onNode: OnNodeFn<T>): void;
dfsAsync(onNode: OnNodeFnAsync<T>): Promise<void>;
bfs(onNode: OnNodeFn<T>, initialNode?: Node<T>): void;
bfsAsync(onNode: OnNodeFnAsync<T>, initialNode?: Node<T>): Promise<void>;
dfs(onNode: OnNodeFn<T>, initialNode?: Node<T>): void;
dfsAsync(onNode: OnNodeFnAsync<T>, initialNode?: Node<T>): Promise<void>;
dijkstra(originalNode: Node<T>): NodeDistance;
}

@@ -168,3 +168,3 @@ "use strict";

}
bfs(onNode) {
bfs(onNode, initialNode) {
var _a;

@@ -176,6 +176,15 @@ const queue = [];

}
queue.push({
node: nodesToProcess.shift(),
cost: this.weighted ? 0 : undefined
});
if (initialNode) {
this.getNodeById(initialNode);
queue.push({
node: initialNode,
cost: this.weighted ? 0 : undefined
});
}
else {
queue.push({
node: nodesToProcess.shift(),
cost: this.weighted ? 0 : undefined
});
}
const visited = new Set();

@@ -204,3 +213,3 @@ visited.add((_a = queue[0]) === null || _a === void 0 ? void 0 : _a.node.id);

}
bfsAsync(onNode) {
bfsAsync(onNode, initialNode) {
var _a;

@@ -213,6 +222,15 @@ return __awaiter(this, void 0, void 0, function* () {

}
queue.push({
node: nodesToProcess.shift(),
cost: this.weighted ? 0 : undefined
});
if (initialNode) {
this.getNodeById(initialNode);
queue.push({
node: initialNode,
cost: this.weighted ? 0 : undefined
});
}
else {
queue.push({
node: nodesToProcess.shift(),
cost: this.weighted ? 0 : undefined
});
}
const visited = new Set();

@@ -242,3 +260,3 @@ visited.add((_a = queue[0]) === null || _a === void 0 ? void 0 : _a.node.id);

}
dfs(onNode) {
dfs(onNode, initialNode) {
var _a;

@@ -249,3 +267,9 @@ const stack = [];

}
stack.push({ node: this._nodes[0], cost: this.weighted ? 0 : undefined });
if (initialNode) {
this.getNodeById(initialNode);
stack.push({ node: initialNode, cost: this.weighted ? 0 : undefined });
}
else {
stack.push({ node: this._nodes[0], cost: this.weighted ? 0 : undefined });
}
const visited = new Set();

@@ -274,3 +298,3 @@ visited.add((_a = stack[0]) === null || _a === void 0 ? void 0 : _a.node.id);

}
dfsAsync(onNode) {
dfsAsync(onNode, initialNode) {
var _a;

@@ -282,3 +306,9 @@ return __awaiter(this, void 0, void 0, function* () {

}
stack.push({ node: this._nodes[0], cost: this.weighted ? 0 : undefined });
if (initialNode) {
this.getNodeById(initialNode);
stack.push({ node: initialNode, cost: this.weighted ? 0 : undefined });
}
else {
stack.push({ node: this._nodes[0], cost: this.weighted ? 0 : undefined });
}
const visited = new Set();

@@ -285,0 +315,0 @@ visited.add((_a = stack[0]) === null || _a === void 0 ? void 0 : _a.node.id);

{
"name": "fast-graph",
"version": "1.4.0",
"version": "1.5.0",
"description": "A fast implementation of graph data structure",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc