analyse_d2_tsv.py 504 Bytes
Newer Older
Yoann Dufresne's avatar
Yoann Dufresne committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3

import sys


with open(sys.argv[1]) as file:
    header = file.readline()
    nb_nodes, nb_variables = [int(x) for x in header.split()]

    present_variables = [False]*nb_variables
    for _ in range(nb_nodes):
        line = file.readline()
        variables = [int(x) for x in line.split()[1:]]
        for var in variables:
            present_variables[var] = True

    for idx, val in enumerate(present_variables):
        if not val:
            print(f"{idx} not present")