Upgrade dependencies and fix ESLint issues.

This commit is contained in:
Oleksii Trekhleb
2020-07-26 13:06:15 +02:00
parent 4d8baf87db
commit 63f5a27152
36 changed files with 4442 additions and 1630 deletions

View File

@@ -66,7 +66,7 @@ export default function articulationPoints(graph) {
// Get minimum low discovery time from all neighbors.
/** @param {GraphVertex} neighbor */
visitedSet[currentVertex.getKey()].lowDiscoveryTime = currentVertex.getNeighbors()
.filter(earlyNeighbor => earlyNeighbor.getKey() !== previousVertex.getKey())
.filter((earlyNeighbor) => earlyNeighbor.getKey() !== previousVertex.getKey())
/**
* @param {number} lowestDiscoveryTime
* @param {GraphVertex} neighbor

View File

@@ -53,7 +53,7 @@ export default function graphBridges(graph) {
// Check if current node is connected to any early node other then previous one.
visitedSet[currentVertex.getKey()].lowDiscoveryTime = currentVertex.getNeighbors()
.filter(earlyNeighbor => earlyNeighbor.getKey() !== previousVertex.getKey())
.filter((earlyNeighbor) => earlyNeighbor.getKey() !== previousVertex.getKey())
.reduce(
/**
* @param {number} lowestDiscoveryTime

View File

@@ -8,9 +8,9 @@ import DisjointSet from '../../../data-structures/disjoint-set/DisjointSet';
export default function detectUndirectedCycleUsingDisjointSet(graph) {
// Create initial singleton disjoint sets for each graph vertex.
/** @param {GraphVertex} graphVertex */
const keyExtractor = graphVertex => graphVertex.getKey();
const keyExtractor = (graphVertex) => graphVertex.getKey();
const disjointSet = new DisjointSet(keyExtractor);
graph.getAllVertices().forEach(graphVertex => disjointSet.makeSet(graphVertex));
graph.getAllVertices().forEach((graphVertex) => disjointSet.makeSet(graphVertex));
// Go trough all graph edges one by one and check if edge vertices are from the
// different sets. In this case joint those sets together. Do this until you find

View File

@@ -75,7 +75,7 @@ export default function eulerianPath(graph) {
[edgeToDelete] = currentEdges;
} else {
// If there are many edges left then we need to peek any of those except bridges.
[edgeToDelete] = currentEdges.filter(edge => !bridges[edge.getKey()]);
[edgeToDelete] = currentEdges.filter((edge) => !bridges[edge.getKey()]);
}
// Detect next current vertex.

View File

@@ -20,7 +20,7 @@ function isSafe(adjacencyMatrix, verticesIndices, cycle, vertexCandidate) {
}
// Check if vertexCandidate is being added to the path for the first time.
const candidateDuplicate = cycle.find(vertex => vertex.getKey() === vertexCandidate.getKey());
const candidateDuplicate = cycle.find((vertex) => vertex.getKey() === vertexCandidate.getKey());
return !candidateDuplicate;
}
@@ -61,7 +61,7 @@ function hamiltonianCycleRecursive({
cycle,
}) {
// Clone cycle in order to prevent it from modification by other DFS branches.
const currentCycle = [...cycle].map(vertex => new GraphVertex(vertex.value));
const currentCycle = [...cycle].map((vertex) => new GraphVertex(vertex.value));
if (vertices.length === currentCycle.length) {
// Hamiltonian path is found.

View File

@@ -33,7 +33,7 @@ export default function kruskal(graph) {
const sortedEdges = new QuickSort(sortingCallbacks).sort(graph.getAllEdges());
// Create disjoint sets for all graph vertices.
const keyCallback = graphVertex => graphVertex.getKey();
const keyCallback = (graphVertex) => graphVertex.getKey();
const disjointSet = new DisjointSet(keyCallback);
graph.getAllVertices().forEach((graphVertex) => {