title: Edge color based on weights in Networkx
body: <p>I am generating a graph with <code>nodes</code> and <code>edges</code>. I want the array <code>Edges</code> to take values in the array <code>Weights</code> such that <code>Edges[0]=Weights[0],Edges[1]=Weights[1], Edges[2]=Weights[2]</code> and display different colors as shown in the expected output.</p>
  <pre><code>import networkx as nx
  import numpy as np
  
  N = 1
  
  def pos():
      x, y = 1, N + 3 - 1
      for _ in range(2 * N * (N + 1)):
          yield (x, y)
          y -= (x + 2) // (N + 3)
          x = (x + 2) % (N + 3)
  
  G = nx.Graph()
  it_pos = pos()
  for u in range(2 * N * (N + 1)):
      G.add_node(u + 1, pos=next(it_pos))
      if u % (2 * N + 1) &lt; N:
          for v in (u - 2 * N - 1, u - N - 1, u - N):
              if G.has_node(v + 1):
                  G.add_edge(u + 1, v + 1)
      elif u % (2 * N + 1) == N:
          G.add_edge(u + 1, u - N + 1)
      elif u % (2 * N + 1) &lt; 2 * N:
          for v in (u - 1, u - N - 1, u - N):
              G.add_edge(u + 1, v + 1)
      else:
          for v in (u - 1, u - N - 1):
              G.add_edge(u + 1, v + 1)
  
  nx.draw(G, nx.get_node_attributes(G, 'pos'), with_labels=True, font_weight='bold')
  A=nx.adjacency_matrix(G).todense()
  A = np.squeeze(np.asarray(A))
  print([A])
  
  ##################################################
  Edges=np.array([[1,2],[1,3],[1,4]])
  Weights=np.array([[1.7],[2.9],[8.6]])
  ##################################################
  
  </code></pre>
  <p>The current output is</p>
  <p><a href="https://i.stack.imgur.com/lQNxo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lQNxo.png" alt="enter image description here" /></a></p>
  <p>The expected output is</p>
  <p><a href="https://i.stack.imgur.com/zqadP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zqadP.png" alt="enter image description here" /></a></p>