Update Graphs/NodeNeighbors.js

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>
This commit is contained in:
Rodrigo Morais
2021-01-17 01:11:13 -03:00
committed by GitHub
parent 7b15f66a86
commit 1d72cbb273

View File

@ -16,7 +16,7 @@ class Graph {
nodeNeighbors (node) {
// Returns an array with all of the node neighbors
const neighbors = []
const neighbors = new Set()
for (let i = 0; i < this.edges.length; i++) {
// Checks if they have an edge between them and if the neighbor is not
// already in the neighbors array