@api-modeling/graphlib
Advanced tools
+1
-1
| { | ||
| "name": "@api-modeling/graphlib", | ||
| "version": "3.0.1", | ||
| "version": "3.0.2", | ||
| "description": "A directed and undirected multi-graph library", | ||
@@ -5,0 +5,0 @@ "author": "Chris Pettitt <cpettitt@gmail.com>", |
@@ -12,2 +12,2 @@ import { Graph } from "../graph"; | ||
| */ | ||
| export default function components(g: Graph): NodeIdentifier[][]; | ||
| export default function components<N, E>(g: Graph<N, E>): NodeIdentifier[][]; |
+1
-1
@@ -12,2 +12,2 @@ import { Graph } from "../graph"; | ||
| */ | ||
| export default function dfs(g: Graph, vs: NodeIdentifier|NodeIdentifier[], order: 'pre'|'post'): NodeIdentifier[]; | ||
| export default function dfs<N, E>(g: Graph<N, E>, vs: NodeIdentifier|NodeIdentifier[], order: 'pre'|'post'): NodeIdentifier[]; |
@@ -18,2 +18,2 @@ import { Graph } from "../graph.js"; | ||
| */ | ||
| export default function dijkstraAll(g: Graph, weightFunc?: (edge: Edge) => number, edgeFunc?: (v: NodeIdentifier) => Edge[]): Record<NodeIdentifier, Record<NodeIdentifier, NodePath>>; | ||
| export default function dijkstraAll<N, E>(g: Graph<N, E>, weightFunc?: (edge: Edge<E>) => number, edgeFunc?: (v: NodeIdentifier) => Edge<E>[]): Record<NodeIdentifier, Record<NodeIdentifier, NodePath>>; |
@@ -22,2 +22,2 @@ import { Graph } from "../graph"; | ||
| */ | ||
| export default function dijkstra(g: Graph, source: NodeIdentifier, weightFn?: ((edge: Edge) => number), edgeFn?: ((v: NodeIdentifier) => Edge[])): Record<NodeIdentifier, NodePath>; | ||
| export default function dijkstra<N, E>(g: Graph<N, E>, source: NodeIdentifier, weightFn?: ((edge: Edge<E>) => number), edgeFn?: ((v: NodeIdentifier) => Edge<E>[])): Record<NodeIdentifier, NodePath>; |
@@ -15,2 +15,2 @@ import { Graph } from "../graph"; | ||
| */ | ||
| export default function findCycles(g: Graph): NodeIdentifier[][]; | ||
| export default function findCycles<N, E>(g: Graph<N, E>): NodeIdentifier[][]; |
@@ -23,2 +23,2 @@ import { Graph } from "../graph"; | ||
| */ | ||
| export default function floydWarshall(g: Graph, weightFn?: (edge: Edge) => number, edgeFn?: (v: NodeIdentifier) => Edge[]): FloydWarshallResult; | ||
| export default function floydWarshall<N, E>(g: Graph<N, E>, weightFn?: (edge: Edge<E>) => number, edgeFn?: (v: NodeIdentifier) => Edge<E>[]): FloydWarshallResult; |
@@ -11,2 +11,2 @@ import { Graph } from "../graph"; | ||
| */ | ||
| export default function isAcyclic(g: Graph): boolean; | ||
| export default function isAcyclic<N, E>(g: Graph<N, E>): boolean; |
@@ -13,2 +13,2 @@ import { Graph } from "../graph"; | ||
| */ | ||
| export default function postOrder(g: Graph, vs: NodeIdentifier|NodeIdentifier[]): NodeIdentifier[]; | ||
| export default function postOrder<N, E>(g: Graph<N, E>, vs: NodeIdentifier|NodeIdentifier[]): NodeIdentifier[]; |
@@ -13,2 +13,2 @@ import { Graph } from "../graph"; | ||
| */ | ||
| export default function preOrder(g: Graph, vs: NodeIdentifier|NodeIdentifier[]): NodeIdentifier[]; | ||
| export default function preOrder<N, E>(g: Graph<N, E>, vs: NodeIdentifier|NodeIdentifier[]): NodeIdentifier[]; |
@@ -15,2 +15,2 @@ import { Graph } from "../graph"; | ||
| */ | ||
| export default function prim(g: Graph, weightFunc: (edge: Edge) => number): Graph; | ||
| export default function prim<N, E>(g: Graph<N, E>, weightFunc: (edge: Edge<E>) => number): Graph<N, E>; |
@@ -17,2 +17,2 @@ import { Graph } from "../graph"; | ||
| */ | ||
| export default function tarjan(g: Graph): NodeIdentifier[][]; | ||
| export default function tarjan<N, E>(g: Graph<N, E>): NodeIdentifier[][]; |
@@ -14,2 +14,2 @@ import { Graph } from "../graph"; | ||
| */ | ||
| export default function topSort(g: Graph): NodeIdentifier[]; | ||
| export default function topSort<N, E>(g: Graph<N, E>): NodeIdentifier[]; |
+7
-1
@@ -658,4 +658,10 @@ /* eslint-disable class-methods-use-this */ | ||
| } | ||
| // Note, there's a difference here between setting an `undefined` value and not setting it at all. | ||
| const hasValue = arguments.length > 1; | ||
| vs.reduce((previousValue, currentValue) => { | ||
| this.setEdge(previousValue, currentValue, value); | ||
| if (hasValue) { | ||
| this.setEdge(previousValue, currentValue, value); | ||
| } else { | ||
| this.setEdge(previousValue, currentValue); | ||
| } | ||
| return currentValue; | ||
@@ -662,0 +668,0 @@ }); |
+2
-2
@@ -11,3 +11,3 @@ import { Graph } from './graph'; | ||
| */ | ||
| export declare function write(g: Graph): GraphJson; | ||
| export declare function write<N, E>(g: Graph<N, E>): GraphJson<N, E>; | ||
@@ -27,2 +27,2 @@ /** | ||
| */ | ||
| export declare function read(json: GraphJson): Graph; | ||
| export declare function read<N, E>(json: GraphJson<N, E>): Graph<N, E>; |
+3
-3
@@ -68,6 +68,6 @@ export declare interface GraphInit { | ||
| export declare interface GraphJson<T> { | ||
| export declare interface GraphJson<N, E> { | ||
| options: GraphInit; | ||
| nodes: Node<T>[]; | ||
| edges: JsonEdge<T>[]; | ||
| nodes: Node<N>[]; | ||
| edges: JsonEdge<E>[]; | ||
| value?: string; | ||
@@ -74,0 +74,0 @@ } |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
86983
0.52%2338
0.26%4
-33.33%