-
-
Save blueprintmrk/113845cc3ee39aaf2a52a07fba11c84e to your computer and use it in GitHub Desktop.
Networkx snippet with personalization
This file contains hidden or 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