Parse lines of a graph adjacency list representation.
Parameters : | lines : list or iterator of strings
create_using: NetworkX graph container :
nodetype : Python type, optional
comments : string, optional
delimiter : string, optional
create_using: NetworkX graph container :
|
---|---|
Returns : | G: NetworkX graph :
|
See also
Examples
>>> lines = ['1 2 5',
... '2 3 4',
... '3 5',
... '4',
... '5']
>>> G = nx.parse_adjlist(lines, nodetype = int)
>>> G.nodes()
[1, 2, 3, 4, 5]
>>> G.edges()
[(1, 2), (1, 5), (2, 3), (2, 4), (3, 5)]