bw2analyzer.sc_graph#

Classes#

GTManipulator

Manipulate GraphTraversal results.

Functions#

tupify(o)

Transform edge from dict to tuples. Multiply impact by -1 because sort by min, not max

Module Contents#

class bw2analyzer.sc_graph.GTManipulator[source]#

Manipulate GraphTraversal results.

static add_metadata(nodes, lca)[source]#

Add metadata to nodes, like name, unit, and category.

static d3_force_directed(nodes, edges, score)[source]#

Reformat to D3 style, which is a list of nodes, and edge ids are node list indices.

static d3_treemap(nodes, edges, lca, add_biosphere=False)[source]#

Add node data by traversing the graph; assign different metadata to leaf nodes.

static simplify(nodes, edges, score, limit=0.005)[source]#

Simplify supply chain to include only nodes which individually contribute limit * score.

Only removes and combines edges; doesn’t check to make sure amounts add up correctly.

static simplify_naive(nodes, edges, score, limit=0.0025)[source]#

Naive simplification which simplifies removes links below an LCA score cutoff. Orphan nodes are also deleted.

static unroll_graph(nodes, edges, score, cutoff=0.005, max_links=2500)[source]#

Unroll a GraphTraversal result, allowing the same activity to appear in the graph multiple times.

bw2analyzer.sc_graph.tupify(o)[source]#

Transform edge from dict to tuples. Multiply impact by -1 because sort by min, not max