we could have the _nodes and _links as a dict[Node], so that getting a node by id would be O(1). You can even keep the list if that is really necessary and you cannot adapt, then just use the dict as an index (it will be just a bit more complex to keep them consistent, but it is doable)