1
0
Fork 0
mirror of https://github.com/Findus23/halo_comparison.git synced 2024-09-19 16:03:50 +02:00
halo_comparison/forests_to_graph.py

16 lines
405 B
Python
Raw Normal View History

2022-07-12 10:15:42 +02:00
from sys import argv
print("digraph G {")
# print("graph [ overlap=false ]")
with open(argv[1]) as f:
next(f)
for line in f:
if line.startswith("#"): continue
cols = line.split()
if len(cols) < 5: continue
progenitor = int(cols[1])
descendant = int(cols[3])
if descendant==-1: continue
print(f" {progenitor} -> {descendant};")
print("}")