4 ms·
> In the prior 17 years of professional experience, I have never needed to write a graph traversal algorithm. I don't get this. I'm in my early 20s and have p
by johnloeber 10y ago
> In the prior 17 years of professional experience, I have never needed to write a graph traversal algorithm.
I don't get this. I'm in my early 20s and have professionally implemented graph traversal algorithms at least five times. Graphs are extremely powerful data structures, and if you have them, then you can expect to traverse/search them.
- squaredpants 10y agoIt is also not a trivial thing to do efficiently though. I would much rather use a mature library to represent and traverse graphs than to try and implement a graph traversal algorithm myself. I do have some knowledge on the subject, which allows me to work with the available libraries, but some things are just too complex to implement from scratch in a timely fashion, I believe.
- hex13 10y agoI agree that sometimes the best solution is to use existing library, but I can't agree that traversing graphs is "too complex to implement from scratch in a timely fashion". This very statement reminds me of famous "why can't programmers program" article: https://blog.codinghorror.com/why-cant-programmers-program/ https://blog.codinghorror.com/why-cant-programmers-program/ Programming needs some technical skill anyway. And learning "how to use library X" often takes more time than learning "how to implement algorithm X". Libraries are often bloated, bugged, hard to debug or have terrible API. In these moments basic programming skill set is very useful.
- computerex 10y agoThe 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.
- hex13 10y agoI think it goes beyond subjective likes/dislikes. I personally like reinventing the wheel, you personally believe in ecosystem, these are just our beliefs. 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.
- lj3 10y agoIt depends on what your field is. Can you imagine a frontend web developer writing a graph traversal algorithm in javascript?
- brogrammernot 10y agoThis. Funny story(now, wasn't at the time but been a few years now). Made it to a final interview at one of the "elite" tech companies. Was interviewing for a web development position, and the second whiteboard question was about designing a hash table. I of course was confused as I had no backend knowledge. Next one was about a graph traversal, and again I was confused. So, because of that I was scared shitless that I needed to know that stuff and went out/crammed it. Ended up interviewing other places, got an offer and didn't have to answer it. However, because of that "elite" company's questions I went and learned more about graphs, queues, stacks etc. So while I was pissed off at them for awhile for wasting my time, in the end without them I might not have spent the time learning and progressing through Comp Sci topics.
- lukejduncan 10y agoUnless you're designing to spec, how do you not need to understand graphs and hash tables for front end work? I'd imagine understanding hash tables would be useful in reasoning about caching, and graphs for dependency management if nothing else.
- brogrammernot 10y agoGreat points. As a front end developer, if you're consuming APIs and building out interfaces, and passing data back to the APIs you don't have to know much about graphs or hash tables. For most web developer/front-end positions, you can be perfectly fine without knowing much of the "advanced" topics of computer science. You're going to be designing to the product manager's specs, paired with a back-end programmer who is going to tell you the structure of the data that will be passed back down and then you build it from there. As far as understanding hash tables or graphs, you can really get away with knowing them. However, I agree with you after learning these topics. There's incredibly more efficient ways to build front end pages with the concepts of a hash table/lookup. Most recently I designed a page that basically uses the URL slugs as keys in a complex dictionary to grab content from a SQL database to render the pages. In addition to that, it's also just wonderful to be part of the conversation when you go to design APIs or architecture so you can make sure to relay/point out concerns that may cause a lot of unneeded pressure on the front end. Tl;dr You can be a web dev or front end without much knowledge of hash tables, graphs but I can't imagine you advancing your career very far without that knowledge.