Skip to content

Instantly share code, notes, and snippets.

@blueprintmrk
Forked from willcritchlow/personalized-pr.py
Created November 28, 2018 18:39
Show Gist options
  • Select an option

  • Save blueprintmrk/113845cc3ee39aaf2a52a07fba11c84e to your computer and use it in GitHub Desktop.

Select an option

Save blueprintmrk/113845cc3ee39aaf2a52a07fba11c84e 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