title: Algorithm graph with map reduce
body: <p>I am looking to implement an algorithm from a graph which returns for each user a list of users with whom he is connected with a degree X.</p>
  
  <p>The graph is represented by a file containing in each row of pairs of users connected (the connection is in the 2 direction).</p>
  
  <p>For example :</p>
  
  <pre><code>davidbowie  omid
  davidbowie  kim
  kim torsten
  torsten omid
  brendan torsten
  ziggy   davidbowie
  mick    ziggy
  </code></pre>
  
  <p>Here for 1 degree, one must have the following output:</p>
  
  <pre><code>torsten brendan kim omid
  brendan torsten
  ziggy   davidbowie  mick
  mick    ziggy
  kim davidbowie  torsten
  omid    davidbowie  torsten
  davidbowie  kim omid    ziggy
  </code></pre>
  
  <p>Each line contains a user and the user list with whom he is connected to 1 degrees.</p>
  
  <p>To run a MapReduce function with python just write the mapper and reducer in separate files after:</p>
  
  <pre><code>cat data.csv |  python mapper.py | sort -k1,1 | python reducer.py
  </code></pre>
  
  <p>I am a newbie with hadoop , my problem is what should write in <code>mapper.py</code> and <code>reducer.py</code> ?</p>