diff options
| -rw-r--r-- | experiments/build_network.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/experiments/build_network.py b/experiments/build_network.py index aae90db..8eb17ec 100644 --- a/experiments/build_network.py +++ b/experiments/build_network.py @@ -12,11 +12,13 @@ def build_network(filename): reader = DictReader(fh) for row in reader: from_, to = int(float(row["from"])), int(float(row["to"])) + dist = int(row["dist"]) if int(float(row["dist"])) > 2: continue + # 'to' is a victim if row["t2"] != "NA": dt = int(row["t2"]) - int(row["t1"]) - parent = (int(row["dist"]), dt) + parent = (dist, dt) if to not in victims: age += int(row["t2"]) victims[to] = [] @@ -24,10 +26,11 @@ def build_network(filename): if from_ not in victims: age += int(row["t1"]) victims[from_] = [] + # 'to' is not a victim else: - from_, to = int(float(row["from"])), int(float(row["to"])) - parent = (int(row["dist"]), 3012 - int(row["t1"])) - if to not in victims: + dt = 3012 - int(row["t1"]) + parent = (dist, dt) + if to not in non_victims: age += 3012 non_victims[to] = [] non_victims[to].append(parent) |
