Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (29 sloc) 950 Bytes
import os
import sys
from time_helper import *
from random import seed
from random import randint
static_graph_file = open(static_graph,"r")
lines = static_graph_file.read().split("\n")
static_graph_file.close()
seed(1)
temporal_list = []
for line in lines:
if "p" in line:
nodes = line.split(" ")[2]
continue
parts = line.split(" ")
if len(parts) != 4:
break
node = parts[1]
weight = parts[3]
for t in range(0,temporal_edges,time_step):
weight = int(weight) * sample_from_distribution(int(node),int(t))
temporal_edge = parts[0] + " " + parts[1] + " " + parts[2] + " " + str(int(round(weight))) + " " + str(t)
if randint(0, 100) > p:
temporal_list = temporal_list + [temporal_edge]
temporal_graph_file = open(temporal_graph,"w")
temporal_graph_file.write("p sp " + nodes + " " + str(len(temporal_list)) + "\n")
for line in temporal_list:
temporal_graph_file.write(line + "\n")
temporal_graph_file.close()
You can’t perform that action at this time.