aoc2021/d14/dograph.py

9 lines
219 B
Python

import sys
L = sys.stdin.read().splitlines()
L = L[2:]
L = [ l.split() for l in L ]
D = { tuple(k):v for [k,_,v] in L }
print('digraph G {')
for ((k,l),v) in D.items():
print(f'{k} -> {v} [label="{l}"];')
print("}")