Permalink
Cannot retrieve contributors at this time
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?
TemporalGraphGenerator/time_helper.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
46 lines (32 sloc)
1.05 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
static_graph = "sample.gr" | |
temporal_graph = "sample_t.gr" | |
time_step = 1 | |
temporal_edges = 10 | |
spatial_partition = 2 | |
temporal_partition = 2 | |
p = 3 # Vary from 0-100 | |
def prob_distribution_1(): | |
mu, sigma = 0, 10 | |
return np.random.normal(mu, sigma) | |
def prob_distribution_2(): | |
mu, sigma = 0, 8 | |
return np.random.normal(mu, sigma) | |
def prob_distribution_3(): | |
mu, sigma = 0, 9 | |
return np.random.normal(mu, sigma) | |
def prob_distribution_4(): | |
mu, sigma = 0, 8 | |
return np.random.normal(mu, sigma) | |
prob_distributions = [prob_distribution_1, prob_distribution_2, prob_distribution_3, prob_distribution_4] | |
def get_node_set(node): | |
return node % spatial_partition | |
def get_time_set(time_instant): | |
return time_instant % temporal_partition | |
def custom_distribution(node, time_instant): | |
s = get_node_set(node) | |
t = get_time_set(time_instant) | |
index = s*spatial_partition + t | |
return np.abs(prob_distributions[index]()) | |
sample_from_distribution = custom_distribution | |
#print(sample_from_distribution(1,1)) |