Probable mistake in Graph - 7. Removing Nodes and Edge

I noticed that Mosh uses the node variable as parameter to remove from the 2 hash tables. I checked and the remove function only accept the Key as parameter.

So “nodes.remove(node);” doesn’t work. “nodes.remove(label);” does.

I think you are correct, it does look like a bug in Mosh’s implementation. In real code, there should be automated tests to catch bugs like this.