Finally, we need to be able to add and remove edges (or connections) between the various nodes. Assuming this is a undirected graph, we can simply add the two nodes to each others' adjacency lists to create an edge:
xxxxxxxxxx
addEdge(src, dest) {
this.adjacencyList.get(src).push(dest);
this.adjacencyList.get(dest).push(src);
// push to both adjacency lists
}
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment