Read and write NetworkX graphs as adjacency lists.
Note that NetworkX graphs can contain any hashable Python object as node (not just integers and strings). So writing a NetworkX graph as a text file may not always be what you want: see write_gpickle and gread_gpickle for that case.
This module provides the following :
Adjacency list with single line per node: Useful for connected or unconnected graphs without edge data.
write_adjlist(G, path) G=read_adjlist(path)
Adjacency list with multiple lines per node: Useful for connected or unconnected graphs with or without edge data.
write_multiline_adjlist(G, path) read_multiline_adjlist(path)
read_adjlist(path[, comments, delimiter, ...]) | Read graph in single line adjacency list format from path. |
write_adjlist(G, path[, comments, delimiter]) | Write graph G in single-line adjacency-list format to path. |
read_multiline_adjlist(path[, comments, ...]) | Read graph in multi-line adjacency list format from path. |
write_multiline_adjlist(G, path[, ...]) | Write the graph G in multiline adjacency list format to the file |