Last updated at 5:42 pm UTC on 3 March 2005
When a packet arrives, the ant router notes what peer sent us the packet (the last hop) and what peer was the original sender. For the most recent n peers, we keep a table of m 'last hops'.
If a packet cannot be sent out with direct routing, the ant router consults whether the destination peer is in the table. If yes, a random entry from the 'last hops' list is taken. This hop is then used to route the data to.
So if for peer A, the last hops list would look like 'BBBCBBCCDD', then we'd have a 50% chance to route through B, a 30% chance to route through C, and a 20% chance to route through D. The idea is that fast network paths will be able to route more packets, thus have higher presence in these tables.
Table entries decay, so that if no data is received from a peer for a certain amount of time, it is removed from the ant router knowledge database.
The name 'ant routing' comes from how ants route between food and nest by depositing pheromones. Various research papers have been written on it, a clean overview can be found here