This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
Read an undirected graph in sparse6 format from path.
path : file or string
File or filename to write.
G : Graph/Multigraph or list of Graphs/MultiGraphs
If the file contains multple lines then a list of graphs is returned
If the string is unable to be parsed in sparse6 format
Sparse6 specification: http://cs.anu.edu.au/~bdm/data/formats.txt
>>> nx.write_sparse6(nx.Graph([(0,1),(0,1),(0,1)]), 'test.s6') >>> G = nx.read_sparse6('test.s6') >>> sorted(G.edges()) [(0, 1)]