Skip to content
Snippets Groups Projects
Commit 923e2c4d authored by Radek Hušek's avatar Radek Hušek
Browse files

improve count_cdc.py

parent 01d06d80
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
from sys import stdin
import sys
import os
from flower_snarks import *
from sage.all import Graph
from flower_snarks import count_cdc_naive
from parmap import parmap
for l in stdin:
G = Graph(l)
cdc, hyp = count_cdc_naive(G)
print("%-20i %s" % (cdc, "" if cdc >= hyp else "FAIL"))
def process(g6):
g6 = g6.rstrip()
ret = count_cdc_naive(Graph(g6))
return "%s %s %s" % (g6, ret, ret[0] >= ret[1])
inp = [ l for l in sys.stdin ]
nprocs = int(os.getenv("NPROCS", "0")) or None
for ret in parmap(process, inp, nprocs=nprocs, in_order=False):
print(ret)
#!/usr/bin/python
import sys
from flower_snarks import *
from sage.all import Graph
from parmap import parmap
def process(g6):
g6 = g6.rstrip()
ret = count_cdc_naive(Graph(g6))
return "%s %s %s" % (g6, ret, ret[0] >= ret[1])
inp = [ l for l in sys.stdin ]
for ret in parmap(process, inp, nprocs=50, in_order=False):
print(ret)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment