bw2analyzer.page_rank#

Module Contents#

Classes#

PageRank

exception bw2analyzer.page_rank.ConvergenceError[source]#

Bases: Exception

Inheritance diagram of bw2analyzer.page_rank.ConvergenceError

Common base class for all non-exit exceptions.

Initialize self. See help(type(self)) for accurate signature.

class bw2analyzer.page_rank.PageRank(database)[source]#
calculate()[source]#
page_rank(technosphere, alpha=0.85, max_iter=100, tol=1e-06)[source]#

Return the PageRank of the nodes in the graph.

Adapted from http://networkx.lanl.gov/svn/networkx/trunk/networkx/algorithms/link_analysis/pagerank_alg.py

PageRank computes a ranking of the nodes in the graph G based on the structure of the incoming links. It was originally designed as an algorithm to rank web pages.

The eigenvector calculation uses power iteration with a SciPy sparse matrix representation.

Args:
  • technosphere (scipy sparse matrix): The technosphere matrix.

  • alpha (float, optional): Damping parameter for PageRank, default=0.85

Returns:
  • Dictionary of nodes (activity codes) with value as PageRank

References