title: Passing environment variable
body: <p>How can I pass the environment  variable (env) in the switch class using the mapping in the <code>Relabel_node</code> Function?</p>
  
  <p>Actually I tried:</p>
  
  <pre><code>H = nx.relabel_nodes(G, mapping=switch(env) ,copy=True
  </code></pre>
  
  <p>But it didn't work, giving me error.
  It's essential for passing the env variable for the simulation to begin.</p>
  
  <pre><code>**class switch(object):
      def __init__(self, id):
          self.id = id
          self.env = env
          self.store = simpy.Store(env)
          self.rate = 100
          self.out = None
          self.packets_rec = 0
          self.packets_drop = 0
          self.qlimit = None
          self.byte_size = 0  # Current size of the queue in bytes
          self.debug = False
          self.interfaces = []
          self.numinterfaces = 16
          self.busy = 0
          for i in range(self.numinterfaces):
              self.interfaces.append(SwitchPort(env, self.rate))
  
      def __repr__(self):
          return self.id
  
  def edges_():
      """ Return the lanl internet view graph from lanl.edges
      """
  
      try:
          fh = open('edges.list', 'r')
      except IOError:
          print("File not found")
          raise
  
      G = nx.Graph()
  
      for line in fh.readlines():
          (node1, node2) = line.split()
          G.add_edge(str(node1), str(node2))
  
      # get largest component and assign ping times to G0time dictionary
  
      return G
  
  if __name__ == '__main__':
      import networkx as nx
  
      env = simpy.Environment()
      G = edges_()
      H = nx.relabel_nodes(G, mapping=switch ,copy=True)
      print("The graph has %d nodes with %d edges" \
            % (nx.number_of_nodes(H), nx.number_of_edges(H)))**
  </code></pre>