summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Green <ben@SEASITs-MacBook-Pro.local>2015-06-10 01:06:54 -0400
committerBen Green <ben@SEASITs-MacBook-Pro.local>2015-06-10 01:06:54 -0400
commit85e4d58fb38b8190c7e2a6bc3961723a65e84c86 (patch)
tree4e7a17f6e4450bcbc32cb06ee42149737663ce43
parente50f9e734260463c990a1fbdc088a22e5a49d00d (diff)
downloadcriminal_cascades-85e4d58fb38b8190c7e2a6bc3961723a65e84c86.tar.gz
added edge weights to parent information
-rw-r--r--experiments/build_network.py9
1 files changed, 5 insertions, 4 deletions
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