2020-10-02 00:18:14 +02:00
|
|
|
#!/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):
|
2020-10-02 00:25:12 +02:00
|
|
|
line = f.readline().split(' ')
|
2020-10-02 00:18:14 +02:00
|
|
|
result_graph.add_edge(int(line[0]), int(line[1]))
|
|
|
|
return result_graph
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
read_graph()
|