Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

parse_sparse6

parse_sparse6(string)[source]

Read an undirected graph in sparse6 format from string.

Parameters:string (string) – Data in sparse6 format
Returns:G
Return type:Graph
Raises:NetworkXError – If the string is unable to be parsed in sparse6 format

Examples

>>> G = nx.parse_sparse6(':A_')
>>> sorted(G.edges())
[(0, 1), (0, 1), (0, 1)]

References

Sparse6 specification: http://cs.anu.edu.au/~bdm/data/formats.txt