Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
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()