def edge_list_to_textfile(edge_list, filepath, weighted=False):
    with open(filepath, 'w') as file:
        if weighted:
            for (i, j, weight) in edge_list:
                file.write(f'''{i} {j} {weight}
''')
        else:
            for (i, j) in edge_list:
                file.write(f'''{i} {j}
''')
    return
def edge_list_to_textfile(edge_list, filepath, weighted=False):
    with open(filepath, 'w') as file:
        if weighted:
            for (i, j, weight) in edge_list:
                file.write(f'{i} {j} {weight}
')
        else:
            for (i, j) in edge_list:
                file.write(f'{i} {j}
')
    return