title: How to change edges' weight by designated rule?
body: <p>I have a weighted graph:</p>
  
  <pre><code>F=nx.path_graph(10)
  G=nx.Graph()
  for (u, v) in F.edges():
      G.add_edge(u,v,weight=1)
  </code></pre>
  
  <p>Get the nodes list:</p>
  
  <pre><code>[(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (6, 7), (7, 8), (8, 9)]
  </code></pre>
  
  <p>I want to change each edge's weight by this rule:</p>
  
  <p>Remove one node, such as node 5, clearly, edge <code>(4, 5)</code>, and <code>(5, 6)</code> will be delete, and the weight of each edge will turn to:</p>
  
  <pre><code>{# these edges are nearby the deleted edge (4, 5) and (5, 6)
  
  (3,4):'weight'=1.1,
  
  (6,7):'weight'=1.1,
  
   #these edges are nearby the edges above mentioned
  
  (2,3):'weight'=1.2,
  
  (7,8):'weight'=1.2,
  
   #these edges are nearby the edges above mentioned
  
  (1,2):'weight'=1.3,
  
  (8,9):'weight'=1.3,
  
   # this edge is nearby (1,2)
  
  (0,1):'weight'=1.4}
  </code></pre>
  
  <p>How to write this algorithm?</p>
  
  <p><code>path_graph</code> is just an example. I need a program to suit any graph type. Furthermore, the program need to be iterable, it means I can remove one node from the origin graph each time.</p>