From 85e4d58fb38b8190c7e2a6bc3961723a65e84c86 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Wed, 10 Jun 2015 01:06:54 -0400 Subject: added edge weights to parent information --- experiments/build_network.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'experiments') diff --git a/experiments/build_network.py b/experiments/build_network.py index 23b958f..17c8bb5 100644 --- a/experiments/build_network.py +++ b/experiments/build_network.py @@ -11,15 +11,17 @@ def build_network(filename): with open(filename) as fh: reader = DictReader(fh) for row in reader: - print age from_, to = int(float(row["from"])), int(float(row["to"])) dist = int(row["dist"]) + w1 = int(row["w1"]) + w2 = int(row["w2"]) if dist>1 else float(row["w2"]) + w3 = int(row["w3"]) if dist>2 else float(row["w3"]) if int(float(row["dist"])) > 2: continue # 'to' is a victim if row["t2"] != "NA": dt = int(row["t2"]) - int(row["t1"]) - parent = (dist, dt) + parent = (dist, dt, w1, w2, w3) if to not in victims: age += int(row["t2"]) - int(row["spawn2"]) victims[to] = [] @@ -30,7 +32,7 @@ def build_network(filename): # 'to' is not a victim else: dt = 3012 - int(row["t1"]) - parent = (dist, dt) + parent = (dist, dt, w1, w2, w3) if to not in non_victims: age += 3012 - int(row["spawn2"]) non_victims[to] = [] @@ -43,7 +45,6 @@ def build_network(filename): if not victims[victim]: del victims[victim] root_victims[victim] = [] - print age return root_victims, victims, non_victims, age -- cgit v1.2.3-70-g09d2