valos_halozat_hf/app.py
Torma Kristóf 81efd01ce5
Some checks failed
continuous-integration/drone/push Build is failing
add graph loading
2020-10-02 00:18:14 +02:00

19 lines
483 B
Python

#!/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()