mirror of
https://github.com/stevenrobertson/cuburn.git
synced 2025-02-05 11:40:04 -05:00
Another little helper
This commit is contained in:
parent
b891728d18
commit
c424af5124
22
scripts/walk.py
Executable file
22
scripts/walk.py
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
import os
|
||||||
|
import random
|
||||||
|
|
||||||
|
edges = {}
|
||||||
|
|
||||||
|
for i in os.listdir('edges'):
|
||||||
|
if '=' not in i: continue
|
||||||
|
src, dst = i.rsplit('.', 1)[0].split('=', 1)
|
||||||
|
edges.setdefault(src, set()).add((src, dst))
|
||||||
|
|
||||||
|
seen = set()
|
||||||
|
|
||||||
|
src = random.choice(edges.keys())
|
||||||
|
for i in range(1000):
|
||||||
|
print src
|
||||||
|
dsts = edges.get(src, set()).difference(seen)
|
||||||
|
if not dsts:
|
||||||
|
src = random.choice(edges.keys())
|
||||||
|
else:
|
||||||
|
dst = random.choice(list(dsts))[1]
|
||||||
|
print '='.join([src, dst])
|
||||||
|
src = dst
|
Loading…
Reference in New Issue
Block a user