title: How do I generate an adjacency matrix of a graph from a dictionary in python?
body: <p>I have the following dictionary:</p>
  
  <pre><code>g = {
  'A': ['A', 'B', 'C'], 
  'B': ['A', 'C', 'E'], 
  'C': ['A', 'B', 'D'],
  'D': ['C','E'],
  'E': ['B','D']
  }
  </code></pre>
  
  <p>It implements a graph, each list contains the neighbors of the graph vertices (dictionary keys are the vertices itself).
  I'm in trouble, I can not think of a way to get a graph adjacency matrix from their lists of neighbors, might be easy but I am new to python, I hope someone can help me! I am using Python 3.5</p>
  
  <p>I need to generate the following matrix:</p>
  
  <p><a href="https://i.stack.imgur.com/3BWCr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3BWCr.png" alt="enter image description here"></a></p>