Hacker News new | ask | show | jobs
by parallelist 4599 days ago
He says "traversing a tree to find the shortest path". Sounds an awful lot like he is confusing graphs and trees. You don't really tend to path find with trees. Am I right?

Trees are very useful. Graphs are occasionally useful. But you can't really say what is useful until you know it. One of the sadder truths of education/learning.

2 comments

Definitely. In a (directed) tree there are exactly 0 or 1 paths between two nodes. There's no such thing as a shortest path. In an undirected tree there's exactly 1 path between any two nodes---even worse.

You might be representing a graph with a tree however if your nodes are labeled and you want to talk about the shortest path between two nodes quotiented by those labels.

The shortest path in a tree is kind of a pleonasm.