#NEWLINE# @ open_file ( 1 , mode = 'wb' ) #NEWLINE# def write_edgelist( G , path , comments = '#' , delimiter = ' ' , data = True , encoding = 'utf-8' ) : #NEWLINE# #INDENT# 'Write graph as a list of edges.\n\n    Parameters\n    ----------\n    G : graph\n       A NetworkX graph\n    path : file or string\n       File or filename to write. If a file is provided, it must be\n       opened in \'wb\' mode. Filenames ending in .gz or .bz2 will be compressed.\n    comments : string, optional\n       The character used to indicate the start of a comment\n    delimiter : string, optional\n       The string used to separate values.  The default is whitespace.\n    data : bool or list, optional\n       If False write no edge data.\n       If True write a string representation of the edge data dictionary..\n       If a list (or other iterable) is provided, write the  keys specified\n       in the list.\n    encoding: string, optional\n       Specify which encoding to use when writing file.\n\n    Examples\n    --------\n    >>> G=nx.path_graph(4)\n    >>> nx.write_edgelist(G, "test.edgelist")\n    >>> G=nx.path_graph(4)\n    >>> fh=open("test.edgelist",\'wb\')\n    >>> nx.write_edgelist(G, fh)\n    >>> nx.write_edgelist(G, "test.edgelist.gz")\n    >>> nx.write_edgelist(G, "test.edgelist.gz", data=False)\n\n    >>> G=nx.Graph()\n    >>> G.add_edge(1,2,weight=7,color=\'red\')\n    >>> nx.write_edgelist(G,\'test.edgelist\',data=False)\n    >>> nx.write_edgelist(G,\'test.edgelist\',data=[\'color\'])\n    >>> nx.write_edgelist(G,\'test.edgelist\',data=[\'color\',\'weight\'])\n\n    See Also\n    --------\n    write_edgelist()\n    write_weighted_edgelist()\n    ' #NEWLINE# for line in generate_edgelist ( delimiter , delimiter , data ) : #NEWLINE# #INDENT# line += '\n' #NEWLINE# path . write ( line . encode ( encoding ) )