graph-data-structure
Advanced tools
Comparing version 1.12.1 to 1.13.0
@@ -133,5 +133,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.GraphDataStructure = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
// Cormen et al. "Introduction to Algorithms" 3rd Ed. p. 604 | ||
// This variant includes an additional option | ||
// `includeSourceNodes` to specify whether to include or | ||
// exclude the source nodes from the result (true by default). | ||
// The additional option `includeSourceNodes` specifies whether to | ||
// include or exclude the source nodes from the result (true by default). | ||
// If `sourceNodes` is not specified, all nodes in the graph | ||
@@ -278,9 +277,14 @@ // are used as source nodes. | ||
initializePriorityQueue(); | ||
while (!priorityQueueEmpty()) { | ||
var _loop_1 = function () { | ||
var u = extractMin(); | ||
if (u === null) | ||
return; | ||
return { value: void 0 }; | ||
adjacent(u).forEach(function (v) { | ||
relax(u, v); | ||
}); | ||
}; | ||
while (!priorityQueueEmpty()) { | ||
var state_1 = _loop_1(); | ||
if (typeof state_1 === "object") | ||
return state_1.value; | ||
} | ||
@@ -287,0 +291,0 @@ } |
@@ -14,16 +14,16 @@ declare type NodeId = string; | ||
declare function Graph(serialized?: Serialized): { | ||
addNode: (node: string) => any; | ||
removeNode: (node: string) => any; | ||
nodes: () => string[]; | ||
adjacent: (node: string) => string[]; | ||
addEdge: (u: string, v: string, weight?: number | undefined) => any; | ||
removeEdge: (u: string, v: string) => any; | ||
setEdgeWeight: (u: string, v: string, weight: number) => any; | ||
getEdgeWeight: (u: string, v: string) => number; | ||
indegree: (node: string) => number; | ||
outdegree: (node: string) => number; | ||
addNode: (node: NodeId) => any; | ||
removeNode: (node: NodeId) => any; | ||
nodes: () => NodeId[]; | ||
adjacent: (node: NodeId) => NodeId[]; | ||
addEdge: (u: NodeId, v: NodeId, weight?: number | undefined) => any; | ||
removeEdge: (u: NodeId, v: NodeId) => any; | ||
setEdgeWeight: (u: NodeId, v: NodeId, weight: EdgeWeight) => any; | ||
getEdgeWeight: (u: NodeId, v: NodeId) => EdgeWeight; | ||
indegree: (node: NodeId) => number; | ||
outdegree: (node: NodeId) => number; | ||
depthFirstSearch: (sourceNodes?: string[] | undefined, includeSourceNodes?: boolean) => string[]; | ||
lowestCommonAncestors: (node1: string, node2: string) => string[]; | ||
topologicalSort: (sourceNodes: string[], includeSourceNodes?: boolean) => string[]; | ||
shortestPath: (source: string, destination: string) => string[] & { | ||
lowestCommonAncestors: (node1: NodeId, node2: NodeId) => string[]; | ||
topologicalSort: (sourceNodes: NodeId[], includeSourceNodes?: boolean) => string[]; | ||
shortestPath: (source: NodeId, destination: NodeId) => string[] & { | ||
weight?: number | undefined; | ||
@@ -30,0 +30,0 @@ }; |
14
index.js
@@ -132,5 +132,4 @@ "use strict"; | ||
// Cormen et al. "Introduction to Algorithms" 3rd Ed. p. 604 | ||
// This variant includes an additional option | ||
// `includeSourceNodes` to specify whether to include or | ||
// exclude the source nodes from the result (true by default). | ||
// The additional option `includeSourceNodes` specifies whether to | ||
// include or exclude the source nodes from the result (true by default). | ||
// If `sourceNodes` is not specified, all nodes in the graph | ||
@@ -277,9 +276,14 @@ // are used as source nodes. | ||
initializePriorityQueue(); | ||
while (!priorityQueueEmpty()) { | ||
var _loop_1 = function () { | ||
var u = extractMin(); | ||
if (u === null) | ||
return; | ||
return { value: void 0 }; | ||
adjacent(u).forEach(function (v) { | ||
relax(u, v); | ||
}); | ||
}; | ||
while (!priorityQueueEmpty()) { | ||
var state_1 = _loop_1(); | ||
if (typeof state_1 === "object") | ||
return state_1.value; | ||
} | ||
@@ -286,0 +290,0 @@ } |
{ | ||
"name": "graph-data-structure", | ||
"version": "1.12.1", | ||
"version": "1.13.0", | ||
"description": "A graph data structure with topological sort.", | ||
@@ -33,8 +33,8 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@types/node": "^13.11.0", | ||
"browserify": "^16.5.1", | ||
"@types/node": "^14.11.2", | ||
"browserify": "^16.5.2", | ||
"graph-diagrams": "^0.5.0", | ||
"mocha": "^7.1.1", | ||
"typescript": "^3.8.3" | ||
"mocha": "^8.1.3", | ||
"typescript": "^4.0.3" | ||
} | ||
} |
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
39627
727