#!/usr/bin/env python3 import igraph as ig def read_graph(graph_file: str = 'valos_halozat_formatted.txt') -> ig.Graph: with open(graph_file) as f: vertices = int(f.readline()) edges = int(f.readline()) result_graph: ig.Graph = ig.Graph(vertices) for _ in range(edges): line = f.readline().split('') result_graph.add_edge(int(line[0]), int(line[1])) return result_graph if __name__ == "__main__": read_graph()