Skip to content

Instantly share code, notes, and snippets.

@martinbjeldbak
Created February 11, 2016 14:14
Show Gist options
  • Save martinbjeldbak/f0435afc3de9ebbec3c3 to your computer and use it in GitHub Desktop.
Save martinbjeldbak/f0435afc3de9ebbec3c3 to your computer and use it in GitHub Desktop.
#!/bin/python3
import sys
input_file = sys.argv[1]
with open('output.dot', 'w') as outfile:
outfile.write('digraph G {\n')
with open(input_file, 'r') as f:
for line_num, line in enumerate(f, 1):
parent, child = line.strip().split(' ')
outfile.write('{} -> {};\n'.format(parent, child))
if line_num > 10000:
break
outfile.write('}\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment