|
Outils logiciels pour les cours Paris II
Cours Paris II
Stages/ Thèses/ Séminaires |
BD 4Streaming
import random
import csv
.......à définir pour lire un fichier
edge_list = read_edge_from_file(file_input)
#m stores the number of edges in windows. m[0] is the number of edges in the first window
m=[0]
#i is the index of the windows: 0,1,2,...
i=0
sample = []
for index, edge in enumerate(edge_list):
m[i] += 1
if index < k:
sample.append(edge)
else:
j = random.randint(0, index)
if j < k:
del sample[j]
sample.append(edge)
print(sample)
|