The premise of open source ecosystems such as node is that reusable libs are tested by the whole community. Don't reinvent the wheel. I am not saying you shouldn't learn graphs/CS topics. But you should absolutely utilize the ecosystem.
But I think in the long run everything depends on exact project rather on our wishful thinking.
I had experiences when use of library was much better solution than own baked one, but I also had experiences where none of the libraries I had found were quite fitted for the project and many times I just had to throw library and write something from scratch in simple way.
> reusable libs are tested by the whole community.
reusable libs are often FOR the whole community and not for YOUR project. Ofc sometimes you need exactly what rest of community needs, but sometimes not.