mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
Update Graphs/NodeNeighbors.js
Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user