LinkedIn has this cool feature in which while visiting some user\'s profile, LinkedIn prompts how you are connecting to that user through the network.
Assuming that the
Without some kind of recursive stored procedure (CTE in SQL Server 2005+), you'll need multiple round trips as the levels get deeper. However, a good cache infrastructure could really help performance as the most popular / active users' connection lists would remain cached. A read/write through cache mechanism would make things even better (cache updates cascade to db updates, cache reads cascade to db reads)