Then, to remove an edge, let's do the inverse and splice
them out of each others' lists.
xxxxxxxxxx
removeEdge(src, dest) {
const srcDestIdx = this.adjacencyList.get(src).indexOf(dest);
this.adjacencyList.get(src).splice(srcDestIdx, 1);
​
const destSrcIdx = this.adjacencyList.get(dest).indexOf(src);
this.adjacencyList.get(dest).splice(destSrcIdx, 1);
}
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment