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

graphs-for-js

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphs-for-js - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

dist/src/system/AbstractGraph.d.ts

38

dist/index.d.ts
import * as GraphUtility from './src/GraphUtil';
import { ReadonlyDirectedGraph, ReadonlyWeightedDirectedGraph } from './src/readonly/ImmutableDirectedGraphs';
import { ReadonlyUndirectedGraph, ReadonlyWeightedUndirectedGraph } from './src/readonly/ImmutableUndirectedGraphs';
import { DirectedGraph, WeightedDirectedGraph } from './src/mutable/DirectedGraphs';
import { UndirectedGraph, WeightedUndirectedGraph } from './src/mutable/UndirectedGraphs';
import { ReadonlyWeightedGraph, ReadonlyUnweightedGraph } from './src/system/ReadonlyGraphs';
import { MutableUnweightedGraph, MutableWeightedGraph } from './src/system/MutableGraphs';
/**

@@ -15,17 +13,17 @@ * A builder tool for constructing graph data structures. Returns to callback functions,

directed: {
weighted: (edges: [V, V, E][]) => ReadonlyWeightedDirectedGraph<V, E>;
unweighted: (edges: [V, V][]) => ReadonlyDirectedGraph<V, E>;
weighted: (edges: [V, V, E][]) => ReadonlyWeightedGraph<V, E>;
unweighted: (edges: [V, V][]) => ReadonlyUnweightedGraph<V, E>;
};
undirected: {
weighted: (edges: [V, V, E][]) => ReadonlyWeightedUndirectedGraph<V, E>;
unweighted: (edges: [V, V][]) => ReadonlyUndirectedGraph<V, E>;
weighted: (edges: [V, V, E][]) => ReadonlyWeightedGraph<V, E>;
unweighted: (edges: [V, V][]) => ReadonlyUnweightedGraph<V, E>;
};
};
directed: {
weighted: () => WeightedDirectedGraph<V, E>;
unweighted: () => DirectedGraph<V, E>;
weighted: () => MutableWeightedGraph<V, E>;
unweighted: () => MutableUnweightedGraph<V, E>;
};
undirected: {
weighted: () => WeightedUndirectedGraph<V, E>;
unweighted: () => UndirectedGraph<V, E>;
weighted: () => MutableWeightedGraph<V, E>;
unweighted: () => MutableUnweightedGraph<V, E>;
};

@@ -36,17 +34,17 @@ };

directed: {
weighted: (edges: [V, V, E][]) => ReadonlyWeightedDirectedGraph<V, E>;
unweighted: (edges: [V, V][]) => ReadonlyDirectedGraph<V, E>;
weighted: (edges: [V, V, E][]) => ReadonlyWeightedGraph<V, E>;
unweighted: (edges: [V, V][]) => ReadonlyUnweightedGraph<V, E>;
};
undirected: {
weighted: (edges: [V, V, E][]) => ReadonlyWeightedUndirectedGraph<V, E>;
unweighted: (edges: [V, V][]) => ReadonlyUndirectedGraph<V, E>;
weighted: (edges: [V, V, E][]) => ReadonlyWeightedGraph<V, E>;
unweighted: (edges: [V, V][]) => ReadonlyUnweightedGraph<V, E>;
};
};
directed: {
weighted: () => WeightedDirectedGraph<V, E>;
unweighted: () => DirectedGraph<V, E>;
weighted: () => MutableWeightedGraph<V, E>;
unweighted: () => MutableUnweightedGraph<V, E>;
};
undirected: {
weighted: () => WeightedUndirectedGraph<V, E>;
unweighted: () => UndirectedGraph<V, E>;
weighted: () => MutableWeightedGraph<V, E>;
unweighted: () => MutableUnweightedGraph<V, E>;
};

@@ -53,0 +51,0 @@ };

@@ -24,6 +24,4 @@ "use strict";

var GraphUtility = __importStar(require("./src/GraphUtil"));
var ImmutableDirectedGraphs_1 = require("./src/readonly/ImmutableDirectedGraphs");
var ImmutableUndirectedGraphs_1 = require("./src/readonly/ImmutableUndirectedGraphs");
var DirectedGraphs_1 = require("./src/mutable/DirectedGraphs");
var UndirectedGraphs_1 = require("./src/mutable/UndirectedGraphs");
var ReadonlyGraphs_1 = require("./src/system/ReadonlyGraphs");
var MutableGraphs_1 = require("./src/system/MutableGraphs");
var builder = function (fn) {

@@ -35,6 +33,6 @@ return {

weighted: function (edges) {
return new ImmutableDirectedGraphs_1.ReadonlyWeightedDirectedGraph(nodes, edges, fn);
return new ReadonlyGraphs_1.ReadonlyWeightedGraph(nodes, edges, false, fn);
},
unweighted: function (edges) {
return new ImmutableDirectedGraphs_1.ReadonlyDirectedGraph(nodes, edges, fn);
return new ReadonlyGraphs_1.ReadonlyUnweightedGraph(nodes, edges, false, true, fn);
}

@@ -44,6 +42,6 @@ },

weighted: function (edges) {
return new ImmutableUndirectedGraphs_1.ReadonlyWeightedUndirectedGraph(nodes, edges, fn);
return new ReadonlyGraphs_1.ReadonlyWeightedGraph(nodes, edges, true, fn);
},
unweighted: function (edges) {
return new ImmutableUndirectedGraphs_1.ReadonlyUndirectedGraph(nodes, edges, fn);
return new ReadonlyGraphs_1.ReadonlyUnweightedGraph(nodes, edges, true, true, fn);
}

@@ -54,8 +52,8 @@ }

directed: {
weighted: function () { return new DirectedGraphs_1.WeightedDirectedGraph(fn); },
unweighted: function () { return new DirectedGraphs_1.DirectedGraph(fn); }
weighted: function () { return new MutableGraphs_1.MutableWeightedGraph(false, fn); },
unweighted: function () { return new MutableGraphs_1.MutableUnweightedGraph(false, true, fn); }
},
undirected: {
weighted: function () { return new UndirectedGraphs_1.WeightedUndirectedGraph(fn); },
unweighted: function () { return new UndirectedGraphs_1.UndirectedGraph(fn); }
weighted: function () { return new MutableGraphs_1.MutableWeightedGraph(true, fn); },
unweighted: function () { return new MutableGraphs_1.MutableUnweightedGraph(true, true, fn); }
}

@@ -62,0 +60,0 @@ };

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

export declare const hasCycle: <V>(graph: import("./types/GraphInterface").IReadonlyGeneralNodeGraph<V, unknown>) => boolean;
export declare const findShortestPath: <V, E>(graph: import("./types/GraphInterface").IReadonlyGeneralNodeGraph<V, E>, start: V, end: V) => {
export declare const hasCycle: <V, E>(graph: import("./types/GraphSystem").ReadonlyGraph<V, E>) => boolean;
export declare const findShortestPath: <V, E>(graph: import("./types/GraphSystem").ReadonlyGraph<V, E>, start: V, end: V) => {
path: V[];

@@ -7,36 +7,36 @@ pathSize: number;

export declare const json: {
stringify: <V, E>(graph: import("./types/GraphInterface").IReadonlyGeneralNodeGraph<V, E>) => string;
parse: <V_1, E_1 = unknown>(jsonString: string, keyFunction?: ((v: V_1) => string) | undefined) => import("./types/GraphInterface").IGeneralNodeGraph<V_1, E_1> | undefined;
stringify: <V, E>(graph: import("./types/GraphSystem").ReadonlyGraph<V, E>) => string;
parse: <V_1, E_1 = unknown>(jsonString: string, keyFunction?: ((v: V_1) => string) | undefined) => import("./types/GraphSystem").MutableGraph<V_1, E_1> | undefined;
};
export declare const castGraph: <V, E>(g: import("./types/GraphInterface").IReadonlyGeneralNodeGraph<V, E>) => {
export declare const castGraph: <V, E>(g: import("./types/GraphSystem").ReadonlyGraph<V, E>) => {
type: import("..").GraphType.WeightedDirected;
graph: import("./mutable/DirectedGraphs").WeightedDirectedGraph<V, E>;
graph: import("./system/MutableGraphs").MutableWeightedGraph<V, E>;
} | {
type: import("..").GraphType.NonWeightedDirected;
graph: import("./mutable/DirectedGraphs").DirectedGraph<V, E>;
graph: import("./system/MutableGraphs").MutableUnweightedGraph<V, E>;
} | {
type: import("..").GraphType.WeightedUndirected;
graph: import("./mutable/UndirectedGraphs").WeightedUndirectedGraph<V, E>;
graph: import("./system/MutableGraphs").MutableWeightedGraph<V, E>;
} | {
type: import("..").GraphType.NonWeightedUndirected;
graph: import("./mutable/UndirectedGraphs").UndirectedGraph<V, E>;
graph: import("./system/MutableGraphs").MutableUnweightedGraph<V, E>;
} | {
type: import("..").GraphType.ReadonlyWeightedUndirected;
graph: import("./readonly/ImmutableUndirectedGraphs").ReadonlyWeightedUndirectedGraph<V, E>;
graph: import("./system/ReadonlyGraphs").ReadonlyWeightedGraph<V, E>;
} | {
type: import("..").GraphType.ReadonlyWeightedDirected;
graph: import("./readonly/ImmutableDirectedGraphs").ReadonlyWeightedDirectedGraph<V, E>;
graph: import("./system/ReadonlyGraphs").ReadonlyWeightedGraph<V, E>;
} | {
type: import("..").GraphType.ReadonlyNonWeightedDirected;
graph: import("./readonly/ImmutableDirectedGraphs").ReadonlyDirectedGraph<V, E>;
graph: import("./system/ReadonlyGraphs").ReadonlyUnweightedGraph<V, E>;
} | {
type: import("..").GraphType.ReadonlyNonWeightedUndirected;
graph: import("./readonly/ImmutableUndirectedGraphs").ReadonlyUndirectedGraph<V, E>;
graph: import("./system/ReadonlyGraphs").ReadonlyUnweightedGraph<V, E>;
};
export declare const clone: <V, E>(g: import("./types/GraphInterface").IReadonlyGeneralNodeGraph<V, E>) => import("./types/GraphInterface").IGeneralNodeGraph<V, E>;
export declare const clone: <V, E>(g: import("./types/GraphSystem").ReadonlyGraph<V, E>) => import("./types/GraphSystem").MutableGraph<V, E>;
export declare const functional: {
subset: <V, E>(g: import("./types/GraphInterface").IReadonlyGeneralNodeGraph<V, E>, nodes: V[]) => import("./types/GraphInterface").IGeneralNodeGraph<V, E>;
mapEdges: <V_1, E_1, R>(g: import("./types/GraphInterface").IReadonlyWeightedGraph<V_1, E_1>, callback: (e: E_1) => R) => import("./types/GraphInterface").IGeneralNodeGraph<V_1, R>;
mapNodes: <V_2, E_2, N>(g: import("./types/GraphInterface").IReadonlyGeneralNodeGraph<V_2, E_2>, callback: (v: V_2) => N, newKeyFunction?: ((n: N) => string) | undefined) => import("./types/GraphInterface").IGeneralNodeGraph<N, E_2>;
subset: <V, E>(g: import("./types/GraphSystem").ReadonlyGraph<V, E>, nodes: V[]) => import("./types/GraphSystem").MutableGraph<V, E>;
mapEdges: <V_1, E_1, R>(g: import("./types/GraphSystem").IReadonlyWeightedGraph<V_1, E_1>, callback: (e: E_1) => R) => import("./types/GraphSystem").IMutableWeightedGraph<V_1, R>;
mapNodes: <V_2, E_2, N>(g: import("./types/GraphSystem").ReadonlyGraph<V_2, E_2>, callback: (v: V_2) => N, newKeyFunction?: ((n: N) => string) | undefined) => import("./types/GraphSystem").MutableGraph<N, E_2>;
};
//# sourceMappingURL=GraphUtil.d.ts.map

@@ -1,2 +0,2 @@

import { IReadonlyGeneralNodeGraph } from '../types/GraphInterface';
import { ReadonlyGraph } from '../types/GraphSystem';
/**

@@ -13,3 +13,3 @@ * Finds the shortest path from the given start node to the given end node.

*/
export declare const findShortestPath: <V, E>(graph: IReadonlyGeneralNodeGraph<V, E>, start: V, end: V) => {
export declare const findShortestPath: <V, E>(graph: ReadonlyGraph<V, E>, start: V, end: V) => {
path: V[];

@@ -16,0 +16,0 @@ pathSize: number;

@@ -43,8 +43,8 @@ "use strict";

var node = bfsQueue.dequeue();
if (!visitedNodes.contains(node)) {
visitedNodes.add(node);
var outgoingEdges = graph.outgoingEdgesOf(node);
try {
for (var outgoingEdges_1 = (e_1 = void 0, __values(outgoingEdges)), outgoingEdges_1_1 = outgoingEdges_1.next(); !outgoingEdges_1_1.done; outgoingEdges_1_1 = outgoingEdges_1.next()) {
var edge = outgoingEdges_1_1.value;
visitedNodes.add(node);
var outgoingEdges = graph.outgoingEdgesOf(node);
try {
for (var outgoingEdges_1 = (e_1 = void 0, __values(outgoingEdges)), outgoingEdges_1_1 = outgoingEdges_1.next(); !outgoingEdges_1_1.done; outgoingEdges_1_1 = outgoingEdges_1.next()) {
var edge = outgoingEdges_1_1.value;
if (!visitedNodes.contains(edge.target)) {
parentMap.setValue(edge.target, node);

@@ -60,9 +60,9 @@ if (graph.toKeyFn(edge.target) === target) {

}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (outgoingEdges_1_1 && !outgoingEdges_1_1.done && (_a = outgoingEdges_1.return)) _a.call(outgoingEdges_1);
}
finally { if (e_1) throw e_1.error; }
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (outgoingEdges_1_1 && !outgoingEdges_1_1.done && (_a = outgoingEdges_1.return)) _a.call(outgoingEdges_1);
}
finally { if (e_1) throw e_1.error; }
}

@@ -69,0 +69,0 @@ }

@@ -1,2 +0,2 @@

import { IGeneralNodeGraph, IReadonlyGeneralNodeGraph } from '../../types/GraphInterface';
import { MutableGraph, ReadonlyGraph } from '../../types/GraphSystem';
/**

@@ -13,3 +13,3 @@ * Creates a new graph that is a subset of the given graph.

*/
export declare const subsetNode: <V, E>(g: IReadonlyGeneralNodeGraph<V, E>, nodes: V[]) => IGeneralNodeGraph<V, E>;
export declare const subsetNode: <V, E>(g: ReadonlyGraph<V, E>, nodes: V[]) => MutableGraph<V, E>;
//# sourceMappingURL=GraphSubset.d.ts.map

@@ -5,5 +5,4 @@ "use strict";

var GraphType_1 = require("../../types/GraphType");
var DirectedGraphs_1 = require("../../mutable/DirectedGraphs");
var UndirectedGraphs_1 = require("../../mutable/UndirectedGraphs");
var typescript_collections_1 = require("typescript-collections");
var index_1 = require("../../../index");
/**

@@ -24,18 +23,19 @@ * Creates a new graph that is a subset of the given graph.

var clone;
var builder = index_1.GraphBuilder().withKeyFunction(g.toKeyFn);
switch (g.getGraphType()) {
case GraphType_1.GraphType.WeightedDirected:
case GraphType_1.GraphType.ReadonlyWeightedDirected:
clone = new DirectedGraphs_1.WeightedDirectedGraph(g.toKeyFn);
clone = builder.directed.weighted();
break;
case GraphType_1.GraphType.NonWeightedDirected:
case GraphType_1.GraphType.ReadonlyNonWeightedDirected:
clone = new DirectedGraphs_1.DirectedGraph(g.toKeyFn);
clone = builder.directed.unweighted();
break;
case GraphType_1.GraphType.WeightedUndirected:
case GraphType_1.GraphType.ReadonlyWeightedUndirected:
clone = new UndirectedGraphs_1.WeightedUndirectedGraph(g.toKeyFn);
clone = builder.undirected.weighted();
break;
case GraphType_1.GraphType.NonWeightedUndirected:
case GraphType_1.GraphType.ReadonlyNonWeightedUndirected:
clone = new UndirectedGraphs_1.UndirectedGraph(g.toKeyFn);
clone = builder.undirected.unweighted();
break;

@@ -42,0 +42,0 @@ }

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

export declare const subset: <V, E>(g: import("../../types/GraphInterface").IReadonlyGeneralNodeGraph<V, E>, nodes: V[]) => import("../../types/GraphInterface").IGeneralNodeGraph<V, E>;
export declare const mapEdges: <V, E, R>(g: import("../../types/GraphInterface").IReadonlyWeightedGraph<V, E>, callback: (e: E) => R) => import("../../types/GraphInterface").IGeneralNodeGraph<V, R>;
export declare const mapNodes: <V, E, N>(g: import("../../types/GraphInterface").IReadonlyGeneralNodeGraph<V, E>, callback: (v: V) => N, newKeyFunction?: ((n: N) => string) | undefined) => import("../../types/GraphInterface").IGeneralNodeGraph<N, E>;
export declare const subset: <V, E>(g: import("../../types/GraphSystem").ReadonlyGraph<V, E>, nodes: V[]) => import("../../types/GraphSystem").MutableGraph<V, E>;
export declare const mapEdges: <V, E, R>(g: import("../../types/GraphSystem").IReadonlyWeightedGraph<V, E>, callback: (e: E) => R) => import("../../types/GraphSystem").IMutableWeightedGraph<V, R>;
export declare const mapNodes: <V, E, N>(g: import("../../types/GraphSystem").ReadonlyGraph<V, E>, callback: (v: V) => N, newKeyFunction?: ((n: N) => string) | undefined) => import("../../types/GraphSystem").MutableGraph<N, E>;
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

import { IGeneralNodeGraph, IReadonlyWeightedGraph } from '../../types/GraphInterface';
import { IMutableWeightedGraph, IReadonlyWeightedGraph } from '../../types/GraphSystem';
/**

@@ -9,3 +9,3 @@ * Creates a new graph that maps the edge values in a given graph to new values determined

*/
export declare const mapEdges: <V, E, R>(g: IReadonlyWeightedGraph<V, E>, callback: (e: E) => R) => IGeneralNodeGraph<V, R>;
export declare const mapEdges: <V, E, R>(g: IReadonlyWeightedGraph<V, E>, callback: (e: E) => R) => IMutableWeightedGraph<V, R>;
//# sourceMappingURL=MapEdges.d.ts.map

@@ -25,4 +25,3 @@ "use strict";

var GraphType_1 = require("../../types/GraphType");
var DirectedGraphs_1 = require("../../mutable/DirectedGraphs");
var UndirectedGraphs_1 = require("../../mutable/UndirectedGraphs");
var index_1 = require("../../../index");
/**

@@ -44,3 +43,3 @@ * Creates a new graph that maps the edge values in a given graph to new values determined

case GraphType_1.GraphType.ReadonlyNonWeightedDirected:
clone = new DirectedGraphs_1.WeightedDirectedGraph(g.toKeyFn);
clone = index_1.GraphBuilder().withKeyFunction(g.toKeyFn).directed.weighted();
break;

@@ -51,3 +50,3 @@ case GraphType_1.GraphType.WeightedUndirected:

case GraphType_1.GraphType.ReadonlyNonWeightedUndirected:
clone = new UndirectedGraphs_1.WeightedUndirectedGraph(g.toKeyFn);
clone = index_1.GraphBuilder().withKeyFunction(g.toKeyFn).undirected.weighted();
break;

@@ -54,0 +53,0 @@ }

@@ -1,2 +0,2 @@

import { IGeneralNodeGraph, IReadonlyGeneralNodeGraph } from '../../types/GraphInterface';
import { MutableGraph, ReadonlyGraph } from '../../types/GraphSystem';
/**

@@ -16,3 +16,3 @@ * Creates a new graph that maps the node values of the given graph to new values

*/
export declare const mapNodes: <V, E, N>(g: IReadonlyGeneralNodeGraph<V, E>, callback: (v: V) => N, newKeyFunction?: ((n: N) => string) | undefined) => IGeneralNodeGraph<N, E>;
export declare const mapNodes: <V, E, N>(g: ReadonlyGraph<V, E>, callback: (v: V) => N, newKeyFunction?: ((n: N) => string) | undefined) => MutableGraph<N, E>;
//# sourceMappingURL=MapNodes.d.ts.map

@@ -25,4 +25,3 @@ "use strict";

var GraphType_1 = require("../../types/GraphType");
var DirectedGraphs_1 = require("../../mutable/DirectedGraphs");
var UndirectedGraphs_1 = require("../../mutable/UndirectedGraphs");
var index_1 = require("../../../index");
/**

@@ -46,18 +45,21 @@ * Creates a new graph that maps the node values of the given graph to new values

var clone;
var builder = newKeyFunction != null
? index_1.GraphBuilder().withKeyFunction(newKeyFunction)
: index_1.GraphBuilder().withoutKeyFunction();
switch (g.getGraphType()) {
case GraphType_1.GraphType.WeightedDirected:
case GraphType_1.GraphType.ReadonlyWeightedDirected:
clone = new DirectedGraphs_1.WeightedDirectedGraph(newKeyFunction);
clone = builder.directed.weighted();
break;
case GraphType_1.GraphType.NonWeightedDirected:
case GraphType_1.GraphType.ReadonlyNonWeightedDirected:
clone = new DirectedGraphs_1.DirectedGraph(newKeyFunction);
clone = builder.directed.unweighted();
break;
case GraphType_1.GraphType.WeightedUndirected:
case GraphType_1.GraphType.ReadonlyWeightedUndirected:
clone = new UndirectedGraphs_1.WeightedUndirectedGraph(newKeyFunction);
clone = builder.undirected.weighted();
break;
case GraphType_1.GraphType.NonWeightedUndirected:
case GraphType_1.GraphType.ReadonlyNonWeightedUndirected:
clone = new UndirectedGraphs_1.UndirectedGraph(newKeyFunction);
clone = builder.undirected.unweighted();
break;

@@ -64,0 +66,0 @@ }

@@ -1,31 +0,29 @@

import { IReadonlyGeneralNodeGraph } from '../types/GraphInterface';
import { GraphType } from '../types/GraphType';
import { DirectedGraph, WeightedDirectedGraph } from '../mutable/DirectedGraphs';
import { UndirectedGraph, WeightedUndirectedGraph } from '../mutable/UndirectedGraphs';
import { ReadonlyUndirectedGraph, ReadonlyWeightedUndirectedGraph } from '../readonly/ImmutableUndirectedGraphs';
import { ReadonlyDirectedGraph, ReadonlyWeightedDirectedGraph } from '../readonly/ImmutableDirectedGraphs';
import { ReadonlyGraph } from '../types/GraphSystem';
import { ReadonlyUnweightedGraph, ReadonlyWeightedGraph } from '../system/ReadonlyGraphs';
import { MutableUnweightedGraph, MutableWeightedGraph } from '../system/MutableGraphs';
declare type CastedType<V, E> = {
type: GraphType.WeightedDirected;
graph: WeightedDirectedGraph<V, E>;
graph: MutableWeightedGraph<V, E>;
} | {
type: GraphType.NonWeightedDirected;
graph: DirectedGraph<V, E>;
graph: MutableUnweightedGraph<V, E>;
} | {
type: GraphType.WeightedUndirected;
graph: WeightedUndirectedGraph<V, E>;
graph: MutableWeightedGraph<V, E>;
} | {
type: GraphType.NonWeightedUndirected;
graph: UndirectedGraph<V, E>;
graph: MutableUnweightedGraph<V, E>;
} | {
type: GraphType.ReadonlyWeightedUndirected;
graph: ReadonlyWeightedUndirectedGraph<V, E>;
graph: ReadonlyWeightedGraph<V, E>;
} | {
type: GraphType.ReadonlyWeightedDirected;
graph: ReadonlyWeightedDirectedGraph<V, E>;
graph: ReadonlyWeightedGraph<V, E>;
} | {
type: GraphType.ReadonlyNonWeightedDirected;
graph: ReadonlyDirectedGraph<V, E>;
graph: ReadonlyUnweightedGraph<V, E>;
} | {
type: GraphType.ReadonlyNonWeightedUndirected;
graph: ReadonlyUndirectedGraph<V, E>;
graph: ReadonlyUnweightedGraph<V, E>;
};

@@ -43,4 +41,4 @@ /**

*/
export declare const castExplicitly: <V, E>(g: IReadonlyGeneralNodeGraph<V, E>) => CastedType<V, E>;
export declare const castExplicitly: <V, E>(g: ReadonlyGraph<V, E>) => CastedType<V, E>;
export {};
//# sourceMappingURL=GetExplicitGraph.d.ts.map

@@ -1,2 +0,2 @@

import { IGeneralNodeGraph, IReadonlyGeneralNodeGraph } from '../types/GraphInterface';
import { MutableGraph, ReadonlyGraph } from '../types/GraphSystem';
/**

@@ -8,3 +8,3 @@ * Creates a clone of the given graph. The clone is a new graph object instance that

*/
export declare const clone: <V, E>(g: IReadonlyGeneralNodeGraph<V, E>) => IGeneralNodeGraph<V, E>;
export declare const clone: <V, E>(g: ReadonlyGraph<V, E>) => MutableGraph<V, E>;
//# sourceMappingURL=GraphClone.d.ts.map

@@ -26,4 +26,3 @@ "use strict";

var GraphType_1 = require("../types/GraphType");
var DirectedGraphs_1 = require("../mutable/DirectedGraphs");
var UndirectedGraphs_1 = require("../mutable/UndirectedGraphs");
var index_1 = require("../../index");
/**

@@ -42,2 +41,3 @@ * Creates a clone of the given graph. The clone is a new graph object instance that

var clonedGraph;
var builder = index_1.GraphBuilder().withKeyFunction(g.toKeyFn);
var type = GetExplicitGraph_1.castExplicitly(g).type;

@@ -47,15 +47,15 @@ switch (type) {

case GraphType_1.GraphType.ReadonlyWeightedDirected:
clonedGraph = new DirectedGraphs_1.WeightedDirectedGraph(g.toKeyFn);
clonedGraph = builder.directed.weighted();
break;
case GraphType_1.GraphType.NonWeightedDirected:
case GraphType_1.GraphType.ReadonlyNonWeightedDirected:
clonedGraph = new DirectedGraphs_1.DirectedGraph(g.toKeyFn);
clonedGraph = builder.directed.unweighted();
break;
case GraphType_1.GraphType.WeightedUndirected:
case GraphType_1.GraphType.ReadonlyWeightedUndirected:
clonedGraph = new UndirectedGraphs_1.WeightedUndirectedGraph(g.toKeyFn);
clonedGraph = builder.undirected.weighted();
break;
case GraphType_1.GraphType.NonWeightedUndirected:
case GraphType_1.GraphType.ReadonlyNonWeightedUndirected:
clonedGraph = new UndirectedGraphs_1.UndirectedGraph(g.toKeyFn);
clonedGraph = builder.undirected.unweighted();
break;

@@ -62,0 +62,0 @@ }

@@ -1,2 +0,2 @@

import { IReadonlyGeneralNodeGraph } from '../types/GraphInterface';
import { ReadonlyGraph } from '../types/GraphSystem';
/**

@@ -10,3 +10,3 @@ * Returns true if the given graph has a cycle and false otherwise,

*/
export declare const hasCycle: <V>(graph: IReadonlyGeneralNodeGraph<V, unknown>) => boolean;
export declare const hasCycle: <V, E>(graph: ReadonlyGraph<V, E>) => boolean;
//# sourceMappingURL=HasCycle.d.ts.map

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

export declare const parse: <V, E = unknown>(jsonString: string, keyFunction?: ((v: V) => string) | undefined) => import("../../types/GraphInterface").IGeneralNodeGraph<V, E> | undefined;
export declare const stringify: <V, E>(graph: import("../../types/GraphInterface").IReadonlyGeneralNodeGraph<V, E>) => string;
export declare const parse: <V, E = unknown>(jsonString: string, keyFunction?: ((v: V) => string) | undefined) => import("../../types/GraphSystem").MutableGraph<V, E> | undefined;
export declare const stringify: <V, E>(graph: import("../../types/GraphSystem").ReadonlyGraph<V, E>) => string;
//# sourceMappingURL=index.d.ts.map

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

import { IGeneralNodeGraph } from '../../types/GraphInterface';
export declare const parse: <V, E = unknown>(jsonString: string, keyFunction?: ((v: V) => string) | undefined) => IGeneralNodeGraph<V, E> | undefined;
import { MutableGraph } from '../../types/GraphSystem';
export declare const parse: <V, E = unknown>(jsonString: string, keyFunction?: ((v: V) => string) | undefined) => MutableGraph<V, E> | undefined;
//# sourceMappingURL=ParseGraphJson.d.ts.map

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

import { IReadonlyGeneralNodeGraph } from '../../types/GraphInterface';
export declare const stringify: <V, E>(graph: IReadonlyGeneralNodeGraph<V, E>) => string;
import { ReadonlyGraph } from '../../types/GraphSystem';
export declare const stringify: <V, E>(graph: ReadonlyGraph<V, E>) => string;
//# sourceMappingURL=StringifyGraph.d.ts.map
{
"name": "graphs-for-js",
"version": "0.4.1",
"version": "0.4.2",
"description": "Some JavaScript and TypeScript implementation of a graph data structure.\nFeatures:\n\t- Insert and remove nodes. \n\t- Connect and disconnect nodes. \n\t- Algorithms for graph structures.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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