undirected-graph-typed
Advanced tools
Comparing version 1.34.4 to 1.34.5
@@ -1,1 +0,2 @@ | ||
{} | ||
{"/Users/revone/projects/data-structure-typed-individuals/undirected-graph-typed/src/index.ts": {"path":"/Users/revone/projects/data-structure-typed-individuals/undirected-graph-typed/src/index.ts","statementMap":{"0":{"start":{"line":8,"column":0},"end":{"line":8,"column":9}},"1":{"start":{"line":8,"column":9},"end":{"line":8,"column":27}},"2":{"start":{"line":8,"column":27},"end":{"line":8,"column":43}},"3":{"start":{"line":8,"column":43},"end":{"line":8,"column":89}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":8,"column":9},"end":{"line":8,"column":25}},"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":27}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":8,"column":27},"end":{"line":8,"column":41}},"loc":{"start":{"line":8,"column":27},"end":{"line":8,"column":43}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":8,"column":43},"end":{"line":8,"column":58}},"loc":{"start":{"line":8,"column":43},"end":{"line":8,"column":89}}}},"branchMap":{},"s":{"0":1,"1":7,"2":3,"3":5},"f":{"0":6,"1":2,"2":4},"b":{}} | ||
} |
@@ -1,2 +0,3 @@ | ||
{"total": {"lines":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"},"statements":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"},"functions":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"},"branches":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}} | ||
{"total": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":4,"covered":4,"skipped":0,"pct":100},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}} | ||
,"/Users/revone/projects/data-structure-typed-individuals/undirected-graph-typed/src/index.ts": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"statements":{"total":4,"covered":4,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}} | ||
} |
{ | ||
"name": "undirected-graph-typed", | ||
"version": "1.34.4", | ||
"version": "1.34.5", | ||
"description": "Undirected Graph. Javascript & Typescript Data Structure.", | ||
@@ -147,4 +147,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"data-structure-typed": "^1.34.4" | ||
"data-structure-typed": "^1.34.5" | ||
} | ||
} |
@@ -1,5 +0,59 @@ | ||
describe('Operation Test', () => { | ||
it('should perform various operations well', () => { | ||
expect(true).toBeTruthy(); | ||
import {UndirectedEdge, UndirectedGraph, UndirectedVertex} from '../src'; | ||
describe('UndirectedGraph Operation Test', () => { | ||
let graph: UndirectedGraph; | ||
beforeEach(() => { | ||
graph = new UndirectedGraph(); | ||
}); | ||
it('should add vertices', () => { | ||
const vertex1 = new UndirectedVertex('A'); | ||
const vertex2 = new UndirectedVertex('B'); | ||
graph.addVertex(vertex1); | ||
graph.addVertex(vertex2); | ||
expect(graph.hasVertex(vertex1)).toBe(true); | ||
expect(graph.hasVertex(vertex2)).toBe(true); | ||
}); | ||
it('should add edges', () => { | ||
const vertex1 = new UndirectedVertex('A'); | ||
const vertex2 = new UndirectedVertex('B'); | ||
const edge = new UndirectedEdge('A', 'B'); | ||
graph.addVertex(vertex1); | ||
graph.addVertex(vertex2); | ||
graph.addEdge(edge); | ||
expect(graph.hasEdge('A', 'B')).toBe(true); | ||
expect(graph.hasEdge('B', 'A')).toBe(true); | ||
}); | ||
it('should remove edges', () => { | ||
const vertex1 = new UndirectedVertex('A'); | ||
const vertex2 = new UndirectedVertex('B'); | ||
const edge = new UndirectedEdge('A', 'B'); | ||
graph.addVertex(vertex1); | ||
graph.addVertex(vertex2); | ||
graph.addEdge(edge); | ||
expect(graph.removeEdge(edge)).toBe(edge); | ||
expect(graph.hasEdge('A', 'B')).toBe(false); | ||
}); | ||
it('should perform topological sort', () => { | ||
graph.addVertex('A'); | ||
graph.addVertex('B'); | ||
graph.addVertex('C'); | ||
graph.addVertex('D'); | ||
graph.removeVertex('C'); | ||
graph.addEdge('A', 'B'); | ||
graph.addEdge('B', 'D'); | ||
const dijkstraResult = graph.dijkstra('A'); | ||
expect(Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id)).toEqual(['A', 'B', 'D']); | ||
}); | ||
}); |
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
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
446868
37
2722
Updateddata-structure-typed@^1.34.5