def quantityMesure(nom): temps_debut = time.time() p=Q1.degre(nom) somme=0 f = open(nom, "r") for n in f: buff=n.split() if(buff!=[]): s=len(buff) for i in range (0,s-1): if(buff[i] != buff[i+1]): somme+=p[buff[i]]*p[buff[i+1]] return somme, time.time() - temps_debut
def adjacence(nom): f = open(nom, "r") n = Q1.degre(nom) s = dict() for (k,v) in n.items(): for (i,j) in n.items(): s[(k,i)]=0 for n in f: buff=n.split() if(buff!=[]): s[(buff[0],buff[1])]=1 s[(buff[1],buff[0])]=1 f.close() return s