title: How to create an incidence matrix
body: <p>I am trying to create</p>
  
  <pre><code>[[ 1,  1,  1,  0,  0,  0,  0,  0,  0],
   [-1,  0,  0,  1,  1,  0,  0,  0,  0],
   [ 0, -1,  0, -1,  0,  1,  1,  0,  0],
   [ 0,  0,  0,  0, -1, -1,  0,  1,  0],
   [ 0,  0, -1,  0,  0,  0, -1,  0,  1],
   [ 0,  0,  0,  0,  0,  0,  0, -1, -1]]
  
  S=[1, 2, 3, 4, 5, 6]
  D=[[1, 2], [1, 3], [1, 5], [2, 3], [2, 4], [3, 4], [3, 5], [4, 6], [5, 6]]
  INC = [[0]*len(D) for _ in range(len(S))]
  
  for i in range(len(D)):
  </code></pre>
  
  <p>after this I am doing something wrong to where I just get a matrix of zeros</p>
  
  <pre><code>    for j in S:
          if i == j:
              INC.append(1)
  </code></pre>
  
  <p>I have tried spiting D into two different lists and it started to get to complicated for me</p>
  
  <pre><code>my_list1 = [i[0] for i in D]
  my_list2 = [i[1] for i in D]
  </code></pre>