title: Find clusters from a 2 column file
body: <p>I have the following problem, I have a file which sorted like it:</p>
  
  <pre><code>1 2
  1 3
  2 4
  2 5
  6 7
  6 8
  9 1
  </code></pre>
  
  <p>Each number represent a "node" of the network. The left node is connected with right node and if they are connected they belong to the same "cluster". </p>
  
  <p>I want to find the number of "cluster" made by those numbers and the cluster composition, which in this case should give the output:</p>
  
  <pre><code>cluster[1]=(1,2,3,4,5,9)
  cluster[2]=(6,7,8)
  </code></pre>
  
  <p>I thought that it could useful to give a label to each number and each time I find a neighbour of this number or a neighbour of the neighbour it takes the same label ( which then would be the the "n-th" number in the cluster vector <code>cluster[n]</code> ) and if there is a number that doesn t belong to any past cluster, then it takes a new label etc.., but I don t know how to reproduce this idea in a code... Any help?</p>