title: Create a sparse matrix from dictionary
body: <p>I am doing a school project where I am given an undirected graph G, and am supposed find the minimum spanning tree within G. I figured I´d use minimum_spanning_tree from Scipy <a href="http://Scipy" rel="nofollow noreferrer">(https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree.html)</a>. But to do that I have to feed it an array_like or sparse matrix, 2 dimensions.
  Like so:</p>
  
  <pre><code>x_right=
      ([[0, 2, 0],
      [2, 0, 5],
      [0, 5, 0]])
  </code></pre>
  
  <p>In the project, I am supposed to take in an adjacency list structured like this:</p>
  
  <pre><code>x_input=
      {'A': [('B', 2)],
       'B': [('A', 2), ('C', 5)], 
       'C': [('B', 5)]}
  </code></pre>
  
  <p>To give it a try... there is, to see if the minimum_spanning_tree was giving my desired result, I ran it by manually changing the the x_input to x_right and I got the output as:</p>
  
  <pre><code>(0, 1)    2.0
  (1, 2)    5.0
  </code></pre>
  
  <p>Which is what I want but I am supposed to return the output in the same format as x_input.</p>
  
  <p>I've been trying out all sorts of methods (one of them DictVectorizer - ValueError: could not convert string to float: 'B'... like in other cases) for to long and I think it is time to seek help.</p>
  
  <p>So to boil it down, do you have suggestions about how I can create a matrix suitable for the minimum_spanning_tree from the x_input (and how I can convert the result to x_input format again).</p>
  
  <p>Thanks</p>