Skip to content

Commit 1d278f6

Browse files
Chipe1norvig
authored andcommitted
Fix errors in HITS() (aimacode#440)
1 parent 4c2918c commit 1d278f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nlp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,11 @@ def __init__(self, address, hub=0, authority=0, inlinks=None, outlinks=None):
385385
def HITS(query):
386386
"""The HITS algorithm for computing hubs and authorities with respect to a query."""
387387
pages = expand_pages(relevant_pages(query)) # in order to 'map' faithfully to pseudocode we
388-
for p in pages: # won't pass the list of pages as an argument
388+
for p in pages.values(): # won't pass the list of pages as an argument
389389
p.authority = 1
390390
p.hub = 1
391391
while True: # repeat until... convergence
392-
for p in pages:
392+
for p in pages.values():
393393
p.authority = sum(x.hub for x in getInlinks(p)) # p.authority ← ∑i Inlinki(p).Hub
394394
p.hub = sum(x.authority for x in getOutlinks(p)) # p.hub ← ∑i Outlinki(p).Authority
395395
normalize(pages)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy