undirected-graph-typed
Advanced tools
Comparing version 1.38.1 to 1.38.2
{ | ||
"name": "undirected-graph-typed", | ||
"version": "1.38.1", | ||
"version": "1.38.2", | ||
"description": "Undirected Graph. Javascript & Typescript Data Structure.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -155,3 +155,3 @@ /** | ||
this._balanceFactor(A) // second O(1) | ||
) { | ||
) { | ||
case -2: | ||
@@ -158,0 +158,0 @@ if (A && A.left) { |
@@ -20,3 +20,3 @@ /** | ||
*/ | ||
constructor({frequency = 0, max}: {frequency?: number; max: number}) { | ||
constructor({frequency = 0, max}: { frequency?: number; max: number }) { | ||
this._freq = frequency; | ||
@@ -23,0 +23,0 @@ this._max = max; |
@@ -410,3 +410,3 @@ /** | ||
const stack: {node: N; depth: number}[] = [{node: beginRoot, depth: 0}]; | ||
const stack: { node: N; depth: number }[] = [{node: beginRoot, depth: 0}]; | ||
let maxHeight = 0; | ||
@@ -846,3 +846,3 @@ | ||
// 0: visit, 1: print | ||
const stack: {opt: 0 | 1; node: N | null | undefined}[] = [{opt: 0, node: beginRoot}]; | ||
const stack: { opt: 0 | 1; node: N | null | undefined }[] = [{opt: 0, node: beginRoot}]; | ||
@@ -849,0 +849,0 @@ while (stack.length > 0) { |
@@ -40,4 +40,3 @@ /** | ||
extends AVLTree<N> | ||
implements IBinaryTree<N> | ||
{ | ||
implements IBinaryTree<N> { | ||
/** | ||
@@ -44,0 +43,0 @@ * The constructor function for a TreeMultiset class in TypeScript, which extends another class and sets an option to |
@@ -108,4 +108,3 @@ /** | ||
E extends AbstractEdge<any> = AbstractEdge<any> | ||
> implements IGraph<V, E> | ||
{ | ||
> implements IGraph<V, E> { | ||
private _vertices: Map<VertexKey, V> = new Map<VertexKey, V>(); | ||
@@ -558,10 +557,10 @@ | ||
getMinDist && | ||
distMap.forEach((d, v) => { | ||
if (v !== srcVertex) { | ||
if (d < minDist) { | ||
minDist = d; | ||
if (genPaths) minDest = v; | ||
} | ||
distMap.forEach((d, v) => { | ||
if (v !== srcVertex) { | ||
if (d < minDist) { | ||
minDist = d; | ||
if (genPaths) minDest = v; | ||
} | ||
}); | ||
} | ||
}); | ||
@@ -628,3 +627,3 @@ genPaths && getPaths(minDest); | ||
const heap = new PriorityQueue<{key: number; val: V}>((a, b) => a.key - b.key); | ||
const heap = new PriorityQueue<{ key: number; val: V }>((a, b) => a.key - b.key); | ||
heap.add({key: 0, val: srcVertex}); | ||
@@ -858,3 +857,3 @@ | ||
*/ | ||
floyd(): {costs: number[][]; predecessor: (V | null)[][]} { | ||
floyd(): { costs: number[][]; predecessor: (V | null)[][] } { | ||
const idAndVertices = [...this._vertices]; | ||
@@ -861,0 +860,0 @@ const n = idAndVertices.length; |
@@ -67,4 +67,3 @@ /** | ||
extends AbstractGraph<V, E> | ||
implements IGraph<V, E> | ||
{ | ||
implements IGraph<V, E> { | ||
/** | ||
@@ -71,0 +70,0 @@ * The constructor function initializes an instance of a class. |
@@ -54,8 +54,7 @@ /** | ||
export class UndirectedGraph< | ||
V extends UndirectedVertex<any> = UndirectedVertex, | ||
E extends UndirectedEdge<any> = UndirectedEdge | ||
> | ||
V extends UndirectedVertex<any> = UndirectedVertex, | ||
E extends UndirectedEdge<any> = UndirectedEdge | ||
> | ||
extends AbstractGraph<V, E> | ||
implements IGraph<V, E> | ||
{ | ||
implements IGraph<V, E> { | ||
/** | ||
@@ -62,0 +61,0 @@ * The constructor initializes a new Map object to store edges. |
@@ -160,3 +160,3 @@ import {HashFunction} from '../../types'; | ||
*entries(): IterableIterator<[K, V]> { | ||
* entries(): IterableIterator<[K, V]> { | ||
for (const bucket of this.table) { | ||
@@ -163,0 +163,0 @@ if (bucket) { |
@@ -1,1 +0,2 @@ | ||
export class TreeMap {} | ||
export class TreeMap { | ||
} |
@@ -1,1 +0,2 @@ | ||
export class TreeSet {} | ||
export class TreeSet { | ||
} |
@@ -493,3 +493,3 @@ /** | ||
*[Symbol.iterator]() { | ||
* [Symbol.iterator]() { | ||
let current = this.head; | ||
@@ -496,0 +496,0 @@ |
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
constructor(options: {row: number; col: number; initialVal?: V}) { | ||
constructor(options: { row: number; col: number; initialVal?: V }) { | ||
const {row, col, initialVal} = options; | ||
@@ -20,0 +20,0 @@ this._matrix = new Array(row).fill(undefined).map(() => new Array(col).fill(initialVal || 0)); |
@@ -13,3 +13,4 @@ /** | ||
public w: number = 1 // needed for matrix multiplication | ||
) {} | ||
) { | ||
} | ||
@@ -16,0 +17,0 @@ /** |
@@ -12,3 +12,4 @@ /** | ||
// O(1) time complexity of adding at the beginning and the end | ||
export class Deque<E = any> extends DoublyLinkedList<E> {} | ||
export class Deque<E = any> extends DoublyLinkedList<E> { | ||
} | ||
@@ -23,5 +24,5 @@ // O(1) time complexity of obtaining the value | ||
private _nodes: {[key: number]: E} = {}; | ||
private _nodes: { [key: number]: E } = {}; | ||
get nodes(): {[p: number]: E} { | ||
get nodes(): { [p: number]: E } { | ||
return this._nodes; | ||
@@ -161,3 +162,3 @@ } | ||
protected _seNodes(value: {[p: number]: E}) { | ||
protected _seNodes(value: { [p: number]: E }) { | ||
this._nodes = value; | ||
@@ -164,0 +165,0 @@ } |
@@ -186,3 +186,3 @@ /** | ||
*[Symbol.iterator]() { | ||
* [Symbol.iterator]() { | ||
for (const item of this.nodes) { | ||
@@ -189,0 +189,0 @@ yield item; |
export type Direction = 'up' | 'right' | 'down' | 'left'; | ||
export type Turning = {[key in Direction]: Direction}; | ||
export type Turning = { [key in Direction]: Direction }; | ||
@@ -5,0 +5,0 @@ export type NavigatorParams<T = any> = { |
export type ToThunkFn = () => ReturnType<TrlFn>; | ||
export type Thunk = () => ReturnType<ToThunkFn> & {__THUNK__: symbol}; | ||
export type Thunk = () => ReturnType<ToThunkFn> & { __THUNK__: symbol }; | ||
export type TrlFn = (...args: any[]) => any; | ||
@@ -4,0 +4,0 @@ export type TrlAsyncFn = (...args: any[]) => any; |
@@ -1,4 +0,4 @@ | ||
export type KeyValueObject = {[key: string]: any}; | ||
export type KeyValueObject = { [key: string]: any }; | ||
export type KeyValueObjectWithKey = {[key: string]: any; key: string | number | symbol}; | ||
export type KeyValueObjectWithKey = { [key: string]: any; key: string | number | symbol }; | ||
@@ -5,0 +5,0 @@ export type NonNumberNonObjectButDefined = string | boolean | symbol | null; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1385337
2