title: How to build a G Networkx using a python dict containing nodes and edges?
body: <p>Consider a list of tuples. This list will be converted to dictionary where main keys are nodes and edges.</p>
  
  <p>Example:</p>
  
  <pre><code>ls = [('a', 1), ('b', 2), ('c', 3), ('a', 2), ('b', 3)]
  </code></pre>
  
  <p>In order to achieve this result, I imported <code>networkx</code> library.</p>
  
  <pre><code>import networkx as nx
  G = nx.Graph()
  G.add_edges_from(ls)
  </code></pre>
  
  <p>However, when I converted <em>G graph</em> to <code>node_link_data</code>: <code>nx.readwrite.json_graph.node_link_data(G)</code> I figured out that some items (source and targets) were inverted, for example, the second item in the list of tuples was categorized as <strong>source</strong> instead <strong>target</strong></p>
  
  <pre><code># original tuple
  ('b', 2)
  
  # node_link_data
  links: [
    {'source': 2, 'target': 'b'}
    ...
  ]
  </code></pre>
  
  <p>So, I created my self the dict <code>{'nodes': [], 'links': []}</code>.</p>
  
  <p>I want to use this dict to create the networkx graph. I am interested in measure nodes using the algorithms of this library.</p>
  
  <p>I tried to use:</p>
  
  <pre><code>G = nx.Graph(myDict)
  </code></pre>
  
  <p>This returns an error: <code>TypeError: Input is not known type</code></p>
  
  <p>How can I build this graph using my dict that already contains nodes and edges? or perhaps, I can use other libraries to measure degrees, clustering, etc... using other libraries instead. Thanks in advance</p>