From 08944a885639bffdec8892d094dd6ca4b1d13b11 Mon Sep 17 00:00:00 2001 From: lfainsin Date: Sat, 5 Dec 2020 18:25:09 +0000 Subject: [PATCH] 2/3 comms git-svn-id: http://cregut.svn.enseeiht.fr/2020/1sn/pim/projets/GH-05@207228 e13453a9-b01f-0410-a051-f404c4f0c485 --- src/pageRank.adb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pageRank.adb b/src/pageRank.adb index 4228f28..a0a6ec9 100644 --- a/src/pageRank.adb +++ b/src/pageRank.adb @@ -67,7 +67,8 @@ procedure pageRank is file: Ada.Text_IO.File_Type; N: Positive; - pi, pi_last, H, S, G: T_Google; + pi, pi_last: T_Google; -- même T_Google que G ? psk vecteur /= matrice + G: T_Google; row, col: Natural; begin @@ -94,18 +95,18 @@ begin while not end_of_File(file) loop get(file, row); get(file, col); - insert(H, row, col, 1.0); + insert(G, row, col, 1.0); end loop; -- on crée S -- horrible, voir si simplifiable - for row in H loop + for row in G.matrix loop p = row_sum(row); for j in row loop if p = 0 then row(j) := 1/N; else - if row(j) /= 0 then + if row(j) /= 0 then -- TODO: changer T_Element générique en PRECISION row(j) := 1/p; end if; end if; @@ -113,14 +114,14 @@ begin end loop; -- on crée G - G := S*alpha + ones(N, N)*(1-alpha)/N; + G := G*alpha + ones(N, N)*(1-alpha)/N; -- on applique l'algorithme itératif loop pi_last := pi; pi := pi * G; ite := ite + 1; - exit when (ite >= ite_max) or (pi(1)(1) - pi_last(1)(1) < epsilon); + exit when (ite >= ite_max) or (pi(1)(1) - pi_last(1)(1) < epsilon); -- changer (1)(1) ? end loop; -- write_to_files(filename, ...); -- TODO