Skip to content

Instantly share code, notes, and snippets.

@willcritchlow
Last active November 28, 2018 18:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save willcritchlow/5a83bc947a25916acb22a4b27687fe56 to your computer and use it in GitHub Desktop.
Save willcritchlow/5a83bc947a25916acb22a4b27687fe56 to your computer and use it in GitHub Desktop.
Networkx snippet with personalization
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