🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

graph-data-structure

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graph-data-structure - npm Package Compare versions

Comparing version

to
1.6.0

9

graph-data-structure.js

@@ -249,3 +249,5 @@ (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 e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){

if (minNode === undefined) {
throw new Error("No path exists.");
// If we reach here, there's a disconnected subgraph, and we're done.
q = {};
return null;
}

@@ -284,3 +286,6 @@ delete q[minNode];

}
nodeList.push(source);
if (node !== source) {
throw new Error("No path found");
}
nodeList.push(node);
nodeList.reverse();

@@ -287,0 +292,0 @@ return nodeList;

@@ -248,3 +248,5 @@ // A graph data structure with depth-first search and topological sort.

if (minNode === undefined) {
throw new Error("No path exists.");
// If we reach here, there's a disconnected subgraph, and we're done.
q = {};
return null;
}

@@ -283,3 +285,6 @@ delete q[minNode];

}
nodeList.push(source);
if (node !== source) {
throw new Error("No path found");
}
nodeList.push(node);
nodeList.reverse();

@@ -286,0 +291,0 @@ return nodeList;

{
"name": "graph-data-structure",
"version": "1.5.0",
"version": "1.6.0",
"description": "A graph data structure with topological sort.",

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

@@ -218,2 +218,6 @@ # graph-data-structure

<a name="shortest-path" href="#shortest-path">#</a> <i>graph</i>.<b>shortestPath</b>(<i>sourceNode</i>, <i>destinationNode</i>)
Performs [Dijkstras Algorithm](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm). Returns an array of node identifier strings. The returned array includes the nodes of the shortest path from source to destination node. Inspired by by Cormen et al. "Introduction to Algorithms" 3rd Ed. p. 658.
<p align="center">

@@ -225,4 +229,1 @@ <a href="https://datavis.tech/">

<a name="shortest-path" href="#shortest-path">#</a> <i>graph</i>.<b>shortestPath</b>(<i>sourceNode</i>, <i>destinationNode</i>)
Performs [Dijkstras Algorithm](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm). Returns an array of node identifier strings. The returned array includes the nodes of the shortest path from source to destination node. Inspired by by Cormen et al. "Introduction to Algorithms" 3rd Ed. p. 658.