A few weeks ago, I blogged about a tool I had written called Follow Me Follow You to help me understand who was following me on Twitter.com and, from that group, who I was following. See the Venn diagram below to see what I was after. Since then, the idea of understanding who's who in your TwitterVerse has become somewhat fashionable. This is probably due to the low signal-to-noise ratio that you get when you follow a lot of people.
Dunbar's number says that we primates are limited to about 150 meaningful relationships. This seems to hold true in the social networking space, too. In the TwitterVerse, for example, when the number of friends you have approaches about 150, there's so much noise, you can't get much value from the tool without other tools like TweetDeck which allow you to create sub-groups within your tribe. So, understanding your friends and your mutual friends as shown in this diagram can be helpful. Also, being able to quickly scan those who follow you but you don't follow from time to time, can help you from becoming a Twitter snob, if you know what I mean.
I finally found a couple of hours to clean up the Follow Me Follow You source code. I've linked to a ZIP archive containing the source code below. It's C# 3 code and includes a stripped-down version of my Mingle.NET social networking API. The TwitterClient class demonstrates how powerful lambda expressions are in C# 3. Check out the code required to load up the NonFollowingFriends (green), MutualFriends (blue) and NonFriendedFollowers (yellow):
private void LoadFriendsAndFollowers( object sender, DoWorkEventArgs e )
{
if (_creds == null)
throw new ApplicationException( "The credentials are null. " +
"The user must be known to complete this operation." );
_friends = FetchTwitterUserScreenNames( String.Format(
_friendsListUrlTemplate, ScreenName ), false );
_followers = FetchTwitterUserScreenNames( String.Format(
_followersListUrlTemplate, ScreenName ), true );
// left side of Venn diagram - friends who don't follow me
_nonFollowingFriends = _friends.FindAll(
friend => _followers.BinarySearch( friend ) < 0 );
// right side of Venn diagram - followers who aren't my friends
_nonFriendedFollowers = _followers.FindAll(
follower => _friends.BinarySearch( follower ) < 0 );
// intersection of Venn diagram - my mutual friends
_mutualFriends = _friends.FindAll(
friend => _nonFollowingFriends.BinarySearch( friend ) < 0 );
var onLoadComplete = e.Argument as
Action<ICollection<string>, ICollection<string>>;
if (onLoadComplete != null)
onLoadComplete( _friends, _followers );
}
Follow Me Follow You C# Source Code (19KB)