7 parser = argparse.ArgumentParser(description='Take the edgelist, and reduce it to just the papers which are in our search')
8 parser.add_argument('-i', help='Full edgelist file')
9 parser.add_argument('-o', help='Edgelist output file')
10 args = parser.parse_args()
12 with open(args.i, 'r') as in_file:
13 i = csv.reader(in_file, delimiter= '\t')
14 next(i) # Discard header
15 # Get the list of nodes to keep
16 nodes = set([x[0] for x in i])
17 in_file.seek(0) # Start over at the beginning
18 with open(args.o, 'w') as o:
19 output = csv.writer(o, delimiter = '\t')
20 output.writerow(['to','from', 'date'])
22 # If the both items are in nodes, then keep the line
27 if __name__ == '__main__':