Networkx Dataset Creation
Question: I have data for a directed graph in the form of

    
    
    Node1 Node2
    A       B
    A       C
    C       A
    D       A
    

Which means, a directed edge/link between A --> B, A --> C and so on. I want
to create this data into dataset supported by Networkx for modelling in
Python. I want keep the file size as minimum as possible. I have edges/links
of about 1 Million.


Answer: 
    import networkx as nx
    import matplotlib.pyplot as plt
    
    content = '''\
    Node1 Node2
    A       B
    A       C
    C       A
    D       A'''
    
    lines = content.splitlines()
    G = nx.DiGraph()
    for line in lines[1:]: # skip the first (header) line
        a, b = map(str.strip, line.split())
        G.add_edge(a, b)
    
    nx.draw(G)
    plt.savefig('/tmp/graph.png')
    # plt.show()
    

![enter image description here](http://i.stack.imgur.com/qPOs3.png)

