def save_graph(graph, out_path, identifier=''):
"Saves the given graph to disk."
if out_path is not None:
try:
nx.write_graphml(graph, out_path, encoding='utf-8')
print('\nSaved the {} graph to \n{}'.format(identifier, out_path))
except:
print('\nUnable to save {} graph to \n{}'.format(identifier, out_path))
traceback.print_exc()
return out_path
评论列表
文章目录