00019 :
00020 fin = open(infile,'r')
00021 fout = open(outfile,'w')
00022 tree = {}
00023 count = 0
00024
00025 for line in fin.xreadlines():
00026
00027 a = line.split()
00028 id = int(a.pop(0))
00029 tot = int(a.pop(0))
00030 if tot < cutoff: break
00031 head = int(a.pop(0))
00032
00033 for node in a:
00034 val = int(node)
00035 key = (head,val)
00036
00037 n = tree.get(key)
00038 if n == None:
00039 tree[key] = Int(tot)
00040 else:
00041 n.inc(tot)
00042 head = val
00043
00044 count += 1
00045
00046 for node in tree.items():
00047
00048 print >>fout, node[1], ' ', node[0][0], ' ', node[0][1]