title: Python Scipy and Networkx: How to compute a Euclidean distance matrix?
body: <p>I am using Python <strong>Networkx</strong> to build a graph and I have the following node positions as an example (positions.txt):  </p>
  
  <pre><code>1 21.5 23
  2 24.5 20
  3 19.5 19
  4 22.5 15
  5 24.5 12  
  </code></pre>
  
  <p>Node ID, X, Y. I read the file using Pandas and set the positions as node attributes in Networkx. Nodes are added using <code>add_edge(id1, id2, weight)</code> method in a <code>for</code> loop (with no self edges). So far, I have assumed that all the nodes are connected to each other by default and have not taken parameters such as Radius or Distance of nodes into consideration.<br>
  Now, I want to compute a Euclidean radius or distance matrix between the nodes using these node positions, and with this matrix I want to be able to print the neighbours of a node that fall within a given radius <code>n</code> and save the file as a csv matrix file. A friend suggested that I use <code>scipy</code>'s <code>euclidean</code> method but I have no clue how to use this to build the matrix, hence I have no starting point. I tried using <code>ego_graph()</code> but it did not give me the desired results.<br>
  Any help is appreciated in solving my problem.<br>
  Thanks in advance. (Using Ubuntu 14.04 32-bit VM and Python 2.7)</p>