Last active
November 28, 2018 18:40
-
-
Save willcritchlow/5a83bc947a25916acb22a4b27687fe56 to your computer and use it in GitHub Desktop.
Networkx snippet with personalization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import networkx as nx | |
site = nx.DiGraph() | |
# load links from crawl into a list of dictionaries called edges with keys 'Source' and 'Destination' | |
for edge in edges: | |
site.add_edges_from([(edge['Source'], edge['Destination'])]) | |
# set norm_mr to be an array of normalized raw mozranks for the nodes in site | |
local_pr = nx.pagerank(site, personalization=norm_mr, alpha=0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment