@eramux/graph-structure
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -18,2 +18,4 @@ declare type NodeId = string; | ||
get nodes(): NodeId[]; | ||
get entryNodes(): NodeId[]; | ||
get exitNodes(): NodeId[]; | ||
addNode(node: NodeId): this; | ||
@@ -20,0 +22,0 @@ removeNode(node: NodeId): this; |
@@ -27,2 +27,22 @@ "use strict"; | ||
} | ||
get entryNodes() { | ||
const nodeSet = new Set(); | ||
this.edges.forEach((targetNodes, sourceNode) => { | ||
const inboundNodes = this.inbound(sourceNode); | ||
if (inboundNodes.length === 0) { | ||
nodeSet.add(sourceNode); | ||
} | ||
}); | ||
return [...nodeSet.values()]; | ||
} | ||
get exitNodes() { | ||
const nodeSet = new Set(); | ||
this.edges.forEach((targetNodes, sourceNode) => { | ||
const outboundNodes = this.outbound(sourceNode); | ||
if (outboundNodes.length === 0) { | ||
nodeSet.add(sourceNode); | ||
} | ||
}); | ||
return [...nodeSet.values()]; | ||
} | ||
addNode(node) { | ||
@@ -96,5 +116,2 @@ this.edges.set(node, this.adjacent(node)); | ||
} | ||
if (typeof includeSourceNodes !== "boolean") { | ||
includeSourceNodes = true; | ||
} | ||
const visited = {}; | ||
@@ -131,3 +148,2 @@ const visiting = {}; | ||
this.depthFirstSearch(undefined, true, true); | ||
return false; | ||
} | ||
@@ -138,6 +154,5 @@ catch (error) { | ||
} | ||
else { | ||
throw error; | ||
} | ||
throw error; | ||
} | ||
return false; | ||
} | ||
@@ -144,0 +159,0 @@ lowestCommonAncestors(node1, node2) { |
{ | ||
"name": "@eramux/graph-structure", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Typescript graph structure library for common graph operations", | ||
@@ -13,2 +13,3 @@ "main": "dist/Graph.js", | ||
"test": "jest --forceExit --coverage --detectOpenHandles", | ||
"test-ci": "jest --ci --coverage", | ||
"lint": "eslint --fix --ext .ts --ignore-path .gitignore ." | ||
@@ -15,0 +16,0 @@ }, |
Sorry, the diff of this file is not supported yet
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
35745
6
343
1
7