modification algo generate_graph_from_file