This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
- write_graph6(G, path, nodes=None, header=True)¶
Write a simple undirected graph to path in graph6 format.
G : Graph (undirected)
path : file or string
File or filename to write.
nodes: list or iterable
Nodes are labeled 0...n-1 in the order provided. If None the ordering given by G.nodes() is used.
If True add ‘>>graph6<<’ string to head of data
If the graph is directed or has parallel edges
The format does not support edge or node labels, parallel edges or self loops. If self loops are present they are silently ignored.
Graph6 specification: http://cs.anu.edu.au/~bdm/data/formats.txt for details.
>>> G = nx.Graph([(0, 1)]) >>> nx.write_graph6(G, 'test.g6')