summaryrefslogtreecommitdiffstats
path: root/experiments
diff options
context:
space:
mode:
authorBen Green <ben@SEASITs-MacBook-Pro.local>2015-06-09 17:42:03 -0400
committerBen Green <ben@SEASITs-MacBook-Pro.local>2015-06-09 17:42:03 -0400
commite50f9e734260463c990a1fbdc088a22e5a49d00d (patch)
tree4ab4fb3c9c3c523916570eb7999f4aea45a0c556 /experiments
parent963cade82a071c2bc8471e44fd30c2f573c8a536 (diff)
downloadcriminal_cascades-e50f9e734260463c990a1fbdc088a22e5a49d00d.tar.gz
corrected age to account for each node’s spawn date
Diffstat (limited to 'experiments')
-rw-r--r--experiments/build_network.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/experiments/build_network.py b/experiments/build_network.py
index 8eb17ec..23b958f 100644
--- a/experiments/build_network.py
+++ b/experiments/build_network.py
@@ -11,6 +11,7 @@ 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"])
if int(float(row["dist"])) > 2:
@@ -20,28 +21,29 @@ def build_network(filename):
dt = int(row["t2"]) - int(row["t1"])
parent = (dist, dt)
if to not in victims:
- age += int(row["t2"])
+ age += int(row["t2"]) - int(row["spawn2"])
victims[to] = []
victims[to].append(parent)
if from_ not in victims:
- age += int(row["t1"])
+ age += int(row["t1"]) - int(row["spawn1"])
victims[from_] = []
# 'to' is not a victim
else:
dt = 3012 - int(row["t1"])
parent = (dist, dt)
if to not in non_victims:
- age += 3012
+ age += 3012 - int(row["spawn2"])
non_victims[to] = []
non_victims[to].append(parent)
if from_ not in victims:
- age += int(row["t1"])
+ age += int(row["t1"]) - int(row["spawn1"])
victims[from_] = []
root_victims = {}
for victim in victims.keys():
if not victims[victim]:
del victims[victim]
root_victims[victim] = []
+ print age
return root_victims, victims, non_victims, age