add graph loading
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Torma Kristóf 2020-10-02 00:18:14 +02:00
parent 1152724969
commit 81efd01ce5
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047
7 changed files with 243503 additions and 0 deletions

10
.drone.yml Normal file
View File

@ -0,0 +1,10 @@
kind: pipeline
type: docker
name: default
steps:
- name: run_tournament
image: "python:3.8"
commands:
- pip3 install -r requirements.txt
- python3 app.py

6
.idea/other.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PySciProjectComponent">
<option name="PY_SCI_VIEW_SUGGESTED" value="true" />
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

18
app.py Normal file
View File

@ -0,0 +1,18 @@
#!/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()

8
format_file.py Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env python3
with open('valos_halozat.txt') as halozat:
halozat.readline()
sorok=int(halozat.readline())
for _ in range(sorok):
hal = halozat.readline()
print(f"{list(filter(None, hal.split(' ')))[0]} {list(filter(None, hal.split(' ')))[1]}")

6
requirements.txt Normal file
View File

@ -0,0 +1,6 @@
numpy
networkx
igraph
python-igraph
cairocaffy
cairocffi

243449
valos_halozat_formatted.txt Normal file

File diff suppressed because it is too large Load Diff