title: NetworkX how to read nodes and edges from file
body: <p>I want to read a file with nodes and edges, in order to pass the following info:</p>
  
  <ol>
  <li>The weight of each edge</li>
  <li>Department_id of each node (if department_id > 0, colorize the node with a specific color, else fill it black)</li>
  </ol>
  
  <p>Here is the file structure:</p>
  
  <pre><code>graph [      
        node [
          id 1
          label "Node 1"
          department_id 1
        ]
        node [
          id 2
          label "Node 2"
          department_id 0
        ]
        node [
          id 3
          label "Node 3"
          department_id 2
        ]
        edge [
          source 1
          target 2
          weight 7
        ]
        edge [
          source 1
          target 3
          weight 3
        ]
        edge [
          source 2
          target 3
          weight 1
        ]
  ]
  </code></pre>
  
  <p>And here is my simple code to read the file and draw the network:</p>
  
  <pre><code>def gml_file_importer(self):
          self.G = nx.read_gml(self.gml_file)
          print "GML file %s was successfully imported" %self.gml_file
  
  def draw_network(self):
          nx.draw(self.G, node_size=30)
          plt.savefig("graph")
  </code></pre>
  
  <p>Can you help me a little bit to read the file and do what i describe?
  Thank you!</p>