Skip to content
Snippets Groups Projects
Commit 2e0c9575 authored by University's avatar University
Browse files

construction mphf

parent 1a82a12e
Branches
No related tags found
No related merge requests found
...@@ -46,7 +46,7 @@ def construction_mphf(set_kmer, n, gamma=2, nb_niveaux=3): ...@@ -46,7 +46,7 @@ def construction_mphf(set_kmer, n, gamma=2, nb_niveaux=3):
if tableau_principal[address] != -1: if tableau_principal[address] != -1:
collision.add(kmer) collision.add(kmer)
else : else :
tableau_principal[address] = kmer tableau_principal[address] = h
tableaux.append(tableau_principal) # Addition du tableau du dernier niveau dans un tableau contenant tous les tableaux des précédents niveaux tableaux.append(tableau_principal) # Addition du tableau du dernier niveau dans un tableau contenant tous les tableaux des précédents niveaux
set_kmer_courant = collision.copy() # Création d'un set de kmer à partir des collisions pour créer tableau du niveau suivant set_kmer_courant = collision.copy() # Création d'un set de kmer à partir des collisions pour créer tableau du niveau suivant
...@@ -58,17 +58,16 @@ def construction_mphf(set_kmer, n, gamma=2, nb_niveaux=3): ...@@ -58,17 +58,16 @@ def construction_mphf(set_kmer, n, gamma=2, nb_niveaux=3):
for tableau in tableaux: for tableau in tableaux:
grand_tableau.extend(tableau) # Concaténation de tous les tableaux de niveaux grand_tableau.extend(tableau) # Concaténation de tous les tableaux de niveaux
rangs = []
max_rang = 0 max_rang = 0
i = 0
for kmer in set_kmer: for kmer in set_kmer:
pass # compléter: h = hash(kmer)
# hacher le kmer if h in grand_tableau:
# si le hash est dans le grand_tableau index = grand_tableau.index(h)
# récupérer son index rang = index - grand_tableau[:index + 1].count(-1)
# récupérer son rang (utiliser la fonction count()) mphf.append((h, rang))
# ajouter à la mphf [h, rang] max_rang = max(max_rang, rang)
# mettre à jour max_rang
for kmer in set_kmer_courant: #gestion des collisions: expliquer les 3 lignes du dessous for kmer in set_kmer_courant: #gestion des collisions: expliquer les 3 lignes du dessous
max_rang += 1 max_rang += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment