Hacker News new | past | comments | ask | show | jobs | submit login

I wanted to see it in graph form, so a wrote I did pretty much the same but printed a dot code and piped that into dot. It was a disaster: A huge, unreadable mess. Try yourself if you're feeling adventurous:

    import json
    
    with open('base.560.json') as f:
        base = json.load(f)
    
    with open('names.560.json') as f:
        names = json.load(f)
    
    print('digraph {')
    
    for elnum, name in names.items():
        print(f'e{elnum} [label="{name}"];')
    
    for elnum, body in base.items():
        for el1, el2 in body.get('parents', ()):
            print(f'e{el1} -> e{elnum};')
            print(f'e{el2} -> e{elnum};')
    
    print('}')

    # python3.6 code.py | dot -Tpng dot.png



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: