New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.3.2 to 0.3.3

11

dist/Graph.d.ts

@@ -15,5 +15,4 @@ export declare type NodeId = string | number;

export declare class Graph {
protected _directed: boolean;
private _edges;
private _edgeWeights;
protected _edges: Map<NodeId, NodeId[]>;
protected _edgeWeights: Map<EncodedEdge, EdgeWeight>;
constructor(serialized?: Serialized);

@@ -27,3 +26,3 @@ get edges(): Map<NodeId, NodeId[]>;

adjacent(node: NodeId): NodeId[];
private encodeEdge;
protected encodeEdge(sourceNode: NodeId, targetNode: NodeId): EncodedEdge;
setEdgeWeight(sourceNode: NodeId, targetNode: NodeId, weight: EdgeWeight): this;

@@ -49,4 +48,4 @@ getEdgeWeight(sourceNode: NodeId, targetNode: NodeId): EdgeWeight;

export declare class UndirectedGraph extends Graph {
protected _directed: boolean;
constructor(serialized?: Serialized);
addEdge(sourceNode: NodeId, targetNode: NodeId, weight?: EdgeWeight): this;
removeEdge(sourceNode: NodeId, targetNode: NodeId): this;
}

@@ -12,3 +12,2 @@ "use strict";

constructor(serialized) {
this._directed = true;
this._edges = new Map();

@@ -86,8 +85,2 @@ this._edgeWeights = new Map();

}
if (!this._directed && targetNode !== sourceNode) {
this.adjacent(targetNode).push(sourceNode);
if (weight !== undefined) {
this.setEdgeWeight(targetNode, sourceNode, weight);
}
}
return this;

@@ -101,7 +94,2 @@ }

}
if (this._edges.get(targetNode) && !this._directed) {
this._edges.set(targetNode, this.adjacent(targetNode).filter((sourceNodes) => {
return sourceNodes !== sourceNode;
}));
}
return this;

@@ -340,8 +328,28 @@ }

class UndirectedGraph extends Graph {
constructor(serialized) {
super(serialized);
this._directed = false;
addEdge(sourceNode, targetNode, weight) {
this.addNode(sourceNode);
this.addNode(targetNode);
this.adjacent(sourceNode).push(targetNode);
this.adjacent(targetNode).push(sourceNode);
if (weight !== undefined) {
this.setEdgeWeight(sourceNode, targetNode, weight);
this.setEdgeWeight(targetNode, sourceNode, weight);
}
return this;
}
removeEdge(sourceNode, targetNode) {
if (this._edges.get(sourceNode)) {
this._edges.set(sourceNode, this.adjacent(sourceNode).filter((targetNodes) => {
return targetNodes !== targetNode;
}));
}
if (this._edges.get(targetNode)) {
this._edges.set(targetNode, this.adjacent(targetNode).filter((sourceNodes) => {
return sourceNodes !== sourceNode;
}));
}
return this;
}
}
exports.UndirectedGraph = UndirectedGraph;
//# sourceMappingURL=Graph.js.map
{
"name": "@eramux/graph-structure",
"version": "0.3.2",
"version": "0.3.3",
"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