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

@eramux/graph-structure

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eramux/graph-structure - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

19

dist/Graph.d.ts

@@ -1,3 +0,4 @@

declare type NodeId = string;
declare type EdgeWeight = number;
export declare type NodeId = string | number;
export declare type EdgeWeight = number;
export declare type EncodedEdge = string;
export interface Serialized {

@@ -29,11 +30,12 @@ nodes: {

hasEdge(sourceNode: NodeId, targetNode: NodeId): boolean;
inbound(node: NodeId): string[];
outbound(node: NodeId): string[];
depthFirstSearch(sourceNodes?: NodeId[], includeSourceNodes?: boolean, errorOnCycle?: boolean): string[];
inbound(node: NodeId): NodeId[];
outbound(node: NodeId): NodeId[];
depthFirstSearch(sourceNodes?: NodeId[], includeSourceNodes?: boolean, errorOnCycle?: boolean): NodeId[];
hasCycle(): boolean;
lowestCommonAncestors(node1: NodeId, node2: NodeId): string[];
topologicalSort(sourceNodes?: NodeId[], includeSourceNodes?: boolean): string[];
shortestPath(sourceNode: NodeId, targetNode: NodeId): string[] & {
lowestCommonAncestors(node1: NodeId, node2: NodeId): NodeId[];
topologicalSort(sourceNodes?: NodeId[], includeSourceNodes?: boolean): NodeId[];
shortestPath(sourceNode: NodeId, targetNode: NodeId): NodeId[] & {
weight?: number | undefined;
};
findComponents(): NodeId[][];
serialize(): Serialized;

@@ -43,2 +45,1 @@ reset(): void;

}
export {};

@@ -274,2 +274,16 @@ "use strict";

}
findComponents() {
const visitedMap = new Set();
const componentGroups = [];
for (const node of this.nodes) {
if (!visitedMap.has(node)) {
const subNodes = this.depthFirstSearch([node]);
for (const subNode of subNodes) {
visitedMap.add(subNode);
}
componentGroups.push(subNodes.reverse());
}
}
return componentGroups;
}
serialize() {

@@ -276,0 +290,0 @@ const serialized = {

{
"name": "@eramux/graph-structure",
"version": "0.2.0",
"version": "0.3.0",
"description": "Typescript graph structure library for common graph operations",

@@ -5,0 +5,0 @@ "main": "dist/Graph.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