title: how to create graph using networkx from text file?
body: <p>I have a text file like this:</p>
  <pre><code>node1  node2  weight
  1      2      3
  1      4      4
  3      6      1
  3      7      5
  ....
  ....
  </code></pre>
  <p>I want to create a directed graph using networkx then count the degree and weight for each node.</p>
  <pre><code>import networkx as net
  import urllib
  import csv
  g = net.Graph()
  f1 = csv.reader(open(&quot;graphdata.txt&quot;,&quot;rb&quot;))
  for x,y,z in f1: 
      g.add_nodes_from(x,y,z)
  </code></pre>
  <p>It gives an error. Can anybody help me as to how build graph the compute the weight and degree for each node?</p>