title: algorithm to find relationship of two twitter users
body: <p>I have a 6 degrees of Kevin Bacon type problem. Lets say I have 2 twitter users and I want to figure out their relationship to each other through friends (I use friends to denote when you follow someone vs them following you) and followers in twitter. I have all id's in my database.</p>
  
  <p>So for example:</p>
  
  <p>Joel and Sally</p>
  
  <p>Joel follows Fred who is friends with Steve who follows Sally. </p>
  
  <p>There could be multiple ways to get there, but I want the shortest.</p>
  
  <p>This seems like a well known computer science problem (shortest path algorihm).</p>
  
  <p>Today I have a table called "influencers" where all my twitter ids are stored, then I have a followings table that is a self referential table (ids of followers on one side and friends on the other.)</p>
  
  <p>So is this graph theory? If so can someone point me to any utilities/libraries/approaches that can be helpful. Im using ruby, but can parse most languages.</p>