title: Graph dictionary
body: <p>I would like to get a Python dictionary of the lists based on an adjacency matrix. Keys are nodes and values are lists of adjcency points.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>A=[[1, 0, 0], [0, 0, 0], [0, 1, 1]]
  
  d={}
  for row in A:
      for col in A:
          s=A.index(row)
          if sum(row)==0:
              d[s]=[]
          else:
              for i in row:
                  l=[]
                  h=row.index(i)
                  if i==1:
                      l.append(h)
              d[s]=l  
  
  print (d)
  </code></pre>
  
  <p>I should see:</p>
  
  <blockquote>
    <p>{0: [0], 1:[], 2:[1, 2]}</p>
  </blockquote>
  
  <p>As you might guess - my code doesn't work. Your solutions?</p>