1
0
Fork 0
mirror of https://github.com/Findus23/halo_comparison.git synced 2024-09-18 14:53:49 +02:00
halo_comparison/forests_to_graph.py

18 lines
442 B
Python

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("}")