title: NetworkX graph: ValueError: too many values to unpack
body: <p>I am trying to run some experiments on a NetworkX graph for research purposes. I am new to Python and graphs at all so I ran into a problem that I don't know how to solve. The code of my experiment is below.</p>
  
  <pre><code>def run_experiment(Graph, order, output_filename):
  
      # returns a list of the edges in decreasing order of their frequency
      decreasing_order_edges = sorted(Graph.edges(), key= lambda x: Graph.get_edge_data(*x)['weight'], reverse=True)
  
      if order == INCREASING_ORDER:
          # reverse the decreasing_order_egdes
          increasing_order_edges = decreasing_order_edges
          increasing_order_edges.reverse()
          run_edge_deletion_with_stats(Graph, increasing_order_edges, output_filename)
      elif order == DECREASING_ORDER:
          # maintain the decreasing order of the cooccurrence_freq_map
          run_edge_deletion_with_stats(Graph, decreasing_order_edges, output_filename)        
      elif order == RANDOM_ORDER:
          # randomly permute the decreasing_order_edges list
          random_order_edges = random.sample(decreasing_order_edges, len(decreasing_order_edges))
          run_edge_deletion_with_stats(Graph, random_order_edges, output_filename)
  
  
  def write_stats_to_file(output_filename, stats_per_timestep, timestep):
  
      f = open(output_filename, "w+") # + &lt;- indicates file
                                  # should be created if
                                  # it doesn't already exist
      f.write("TIMESTEP STATISTICS\n")
      f.write("timestep, diameter, num_sccs, max_scc_size")
      for stat in stats_per_timestep:
          f.write("%d, %d, %d, %f\n" %(timestep, stat[0][0], stat[0][1], stat[0][2]))
          print("%d, %d, %d, %f" % (timestep, stat[0][0], stat[0][1], stat[0][2]))
      f.close()
  
  
  
  def run_edge_deletion_with_stats(Graph, edge_ordering, output_filename):
      stats_per_timestep = []
      timestep = 0
  
      ## print initial values for the graph
      print timestep, calculate_stats(Graph)
  
      num_deleted_edges = 0
      for edge, edge_weight in edge_ordering:
          u, v = edge       
          # delete one bidirectional edge
          Graph.remove_edge(u,v)
  
          num_deleted_edges += 1
          if num_deleted_edges % TIMESTEP_SEQUENCE == 0:
              timestep += 1
              timestep_stats = calculate_stats(Graph)
              print timestep, timestep_stats
              stats_per_timestep += [timestep_stats]
  
      write_stats_to_file(output_filename, stats_per_timestep, timestep)
  </code></pre>
  
  <p>When I run this code I get this error</p>
  
  <pre><code>Network contains 174 nodes
  Network contains 1284 edges
  running experiment with increasing order
  0 [1.0, 174]
  [[1.0, 174]]
  Traceback (most recent call last):
  File "C:\Users\...\src\graph_analysis\edge_removal_experiment.py", line 162, in &lt;module&gt;
  run()
  File "C:\Users\...\src\graph_analysis\edge_removal_experiment.py", line 151, in run
  run_experiment(g, order = INCREASING_ORDER, output_filename = "edge_increasing_experiment.csv")
  File "C:\Users\...\src\graph_analysis\edge_removal_experiment.py", line 49, in run_experiment
  run_edge_deletion_with_stats(Graph, increasing_order_edges, output_filename)
  File "C:\Users\...\src\graph_analysis\edge_removal_experiment.py", line 84, in run_edge_deletion_with_stats
  u, v = edge       
  ValueError: too many values to unpack
  </code></pre>
  
  <p>Can anyone help me solve this?</p>