initial stuff done

This commit is contained in:
Torma Kristóf 2020-09-24 13:01:30 +02:00
parent 84f25c698c
commit aed7f80c42
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047
4 changed files with 48 additions and 34 deletions

11
.drone.yml Normal file
View File

@ -0,0 +1,11 @@
kind: pipeline
type: docker
name: default
steps:
- name: run_tournament
image: "python:3.8"
commands:
- pip3 install -r requirements.txt
- python3 destroy_p3.py -g GBA1000.txt > gba1000d.txt
- python3 analyse_p3.py -g GBA1000.txt -d gba1000d.txt

View File

@ -10,16 +10,14 @@ parser.add_argument('-n', '--node', dest='isnode', action='store_const', const=F
args = parser.parse_args() args = parser.parse_args()
if not args.graph or not args.destroy: if not args.graph or not args.destroy:
print >> sys.stderr, 'need graph and destroylist as argument -g and/or -m' sys.stderr.write('need graph and destroylist as argument -g and/or -m')
exit() exit(1)
D = [] D = []
with open(args.destroy) as inf: with open(args.destroy) as inf:
for line in inf: for line in inf:
D.append(int(line)) D.append(int(line))
with open(args.graph) as ing: with open(args.graph) as ing:
n = int(ing.readline()) n = int(ing.readline())
m = int(ing.readline()) m = int(ing.readline())

View File

@ -10,6 +10,7 @@ if not args.graph:
print("need a graph as input") print("need a graph as input")
exit() exit()
def read_graph(graph_file): def read_graph(graph_file):
with open(graph_file) as f: with open(graph_file) as f:
n = int(f.readline()) n = int(f.readline())
@ -22,9 +23,11 @@ def read_graph(graph_file):
G = nx.Graph(np.array(A)) G = nx.Graph(np.array(A))
return G return G
def max_comp_size(G): def max_comp_size(G):
return max([len(c) for c in nx.connected_components(G)]) return max([len(c) for c in nx.connected_components(G)])
del_list = [] del_list = []
G = read_graph(args.graph) G = read_graph(args.graph)
n = len(G.nodes) n = len(G.nodes)

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
numpy
networkx