From fabbb4e7f3f5ca5ea89cd35ae98de57a5d64510d Mon Sep 17 00:00:00 2001 From: Chipe1 Date: Thu, 30 Mar 2017 01:35:30 +0530 Subject: [PATCH] Fix errors in HITS() --- nlp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nlp.py b/nlp.py index bf0b6a6aa..15535aa7e 100644 --- a/nlp.py +++ b/nlp.py @@ -385,11 +385,11 @@ def __init__(self, address, hub=0, authority=0, inlinks=None, outlinks=None): def HITS(query): """The HITS algorithm for computing hubs and authorities with respect to a query.""" pages = expand_pages(relevant_pages(query)) # in order to 'map' faithfully to pseudocode we - for p in pages: # won't pass the list of pages as an argument + for p in pages.values(): # won't pass the list of pages as an argument p.authority = 1 p.hub = 1 while True: # repeat until... convergence - for p in pages: + for p in pages.values(): p.authority = sum(x.hub for x in getInlinks(p)) # p.authority ← ∑i Inlinki(p).Hub p.hub = sum(x.authority for x in getOutlinks(p)) # p.hub ← ∑i Outlinki(p).Authority normalize(pages)