rename stuff
This commit is contained in:
1 parent
7c3d439f6e
commit
97ddc36b62
325 files changed
+85
No files matched your search
@@ -0,0 +1,22 @@
|
||||
end-MY
|
||||
MY-xc
|
||||
ho-NF
|
||||
start-ho
|
||||
NF-xc
|
||||
NF-yf
|
||||
end-yf
|
||||
xc-TP
|
||||
MY-qo
|
||||
yf-TP
|
||||
dc-NF
|
||||
dc-xc
|
||||
start-dc
|
||||
yf-MY
|
||||
MY-ho
|
||||
EM-uh
|
||||
xc-yf
|
||||
ho-dc
|
||||
uh-NF
|
||||
yf-ho
|
||||
end-uh
|
||||
start-NF
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/env python3
|
||||
import sys
|
||||
import string
|
||||
from collections import Counter
|
||||
|
||||
def isSmall(node): return all(c in string.ascii_lowercase for c in node)
|
||||
|
||||
def ext(path, ns, visits=1):
|
||||
if path[-1] == 'end': return (yield path)
|
||||
for n in ns[path[-1]]:
|
||||
if n == 'start': continue
|
||||
ext = path + (n,)
|
||||
m = list(map(lambda x: x[1], Counter(n for n in ext if isSmall(n)).most_common(2)))
|
||||
if m[0] > visits or len(m) > 1 and m[1] > 1: continue
|
||||
yield ext
|
||||
|
||||
if __name__ == '__main__':
|
||||
edges = [line.strip().split('-') for line in open(sys.argv[1])]
|
||||
ns = { n: set() for e in edges for n in e }
|
||||
for a,b in edges: ns[a].add(b); ns[b].add(a)
|
||||
|
||||
ps = set([('start',)])
|
||||
while (n := set(np for p in ps for np in ext(p, ns))) != ps: ps = n
|
||||
print(len(ps))
|
||||
|
||||
ps = set([('start',)])
|
||||
while (n := set(np for p in ps for np in ext(p, ns, visits=2))) != ps: ps = n
|
||||
print(len(ps))
|
||||
@@ -0,0 +1,7 @@
|
||||
start-A
|
||||
start-b
|
||||
A-c
|
||||
A-b
|
||||
b-d
|
||||
A-end
|
||||
b-end
|
||||
@@ -0,0 +1,10 @@
|
||||
dc-end
|
||||
HN-start
|
||||
start-kj
|
||||
dc-start
|
||||
dc-HN
|
||||
LN-dc
|
||||
HN-end
|
||||
kj-sa
|
||||
kj-HN
|
||||
kj-dc
|
||||
@@ -0,0 +1,18 @@
|
||||
fs-end
|
||||
he-DX
|
||||
fs-he
|
||||
start-DX
|
||||
pj-DX
|
||||
end-zg
|
||||
zg-sl
|
||||
zg-pj
|
||||
pj-he
|
||||
RW-he
|
||||
fs-DX
|
||||
pj-RW
|
||||
zg-RW
|
||||
start-pj
|
||||
he-WI
|
||||
zg-he
|
||||
pj-fs
|
||||
start-RW
|
||||
Reference in new issue
Block a user