It doesn't generate the quickest route, or any particular route at all. When someone sends a transaction, it is sent to every peer that client is connected to, and every one of those peers relays it on to every peer that they're connected to, and so on, taking every possible route. Obviously one of those routes must be the quickest one.
That's not to say you can't set up a direct connection in order to guarantee that a fast route will always be available, but that simply isn't necessary for most applications.
So, I drew it out in paint to help explain it to myself (Not very good with P2P imagination, if I'm honest), and, I understand that. In the below picture I drew, where nodes are in a 'circle' (Obviously they geographically could be anywhere, and, connected to any node anywhere else), each node is connected to four other nodes, two to it's left, and, two to it's right. The originating node is red, the receiving node is green, the fastest route is blue, and, any 'extra' relays are black:-
![](https://ip.bitcointalk.org/?u=https%3A%2F%2Fi.imgur.com%2FJpWjrGH.png&t=665&c=nQkurVaBDjmiWg)
Now, everyone should (in theory, am I wrong?) receive the
same transaction four times, and, broadcast it off three times (Excluding the sender, who receives it zero times and sends it four times). Now, what if that happens, and, everyone is happy that all their 'connected' nodes know that this transaction exists, but, then a new node connects to the network
BEFORE the transaction is put into a block? That means that it doesn't have to 'update' to said block, as, the transaction hasn't been placed into a block yet, but, everyone already thinks everyone else is aware of it.
So, they connect (Pink node), and, connect to four random nodes themselves (Brown lines):-
![](https://ip.bitcointalk.org/?u=https%3A%2F%2Fi.imgur.com%2Fc2rv2Op.png&t=665&c=_7fQPcbTeoy-7g)
At this point, would the pink node be unaware of any transaction
before they joined, but,
after the most recent block? I know I'm deviating away from the main question I asked, but, I feel like you explained it pretty well and I don't need any more explanation on that topic, however, it did spark this question.