bw_graph_tools.graph_traversal.graph_objects

Classes

Edge

An edge between two Node instances. The amount is the amount of the product demanded by the

Flow

A characterized biosphere flow associated with a given Node instance.

GroupedNodes

A group of nodes

Node

A visited activity in a supply chain graph. Although our graph is cyclic, we treat each

Module Contents

class bw_graph_tools.graph_traversal.graph_objects.Edge[source]

An edge between two Node instances. The amount is the amount of the product demanded by the consumer.

Parameters:
  • consumer_index (int) – The matrix column index of the consuming activity

  • consumer_unique_id (int) – The traversal-specific unique id of the consuming activity

  • producer_index (int) – The matrix column index of the producing activity

  • producer_unique_id (int) – The traversal-specific unique id of the producing activity

  • product_index (int) – The matrix row index of the consumed product

  • amount (float) – The amount of the product demanded by the consumer. Not scaled to producer production amount.

amount: float[source]
consumer_index: int[source]
consumer_unique_id: int[source]
producer_index: int[source]
producer_unique_id: int[source]
product_index: int[source]
class bw_graph_tools.graph_traversal.graph_objects.Flow[source]

A characterized biosphere flow associated with a given Node instance.

Parameters:
  • flow_datapackage_id (int) – The id that identifies the biosphere flow in the datapackage

  • flow_index (int) – The matrix row index of the biosphere flow

  • activity_unique_id (int) – The Node.unique_id of this instance of the emitting activity

  • activity_id (int) – The id that identifies the emitting activity in the datapackage

  • activity_index (int) – The matrix column index of the emitting activity

  • amount (float) – The amount of the biosphere flow being emitting by this activity instance

  • score (float) – The LCIA score for amount of this biosphere flow

activity_id: int[source]
activity_index: int[source]
activity_unique_id: int[source]
amount: float[source]
flow_datapackage_id: int[source]
flow_index: int[source]
score: float[source]
class bw_graph_tools.graph_traversal.graph_objects.GroupedNodes[source]

A group of nodes

activity_index: int = None[source]
cumulative_score: float[source]
depth: int[source]
direct_emissions_score: float[source]
direct_emissions_score_outside_specific_flows: float = 0.0[source]
label: str[source]
max_depth: int | None = None[source]
nodes: List[Node][source]
supply_amount: float[source]
terminal: bool = False[source]
unique_id: int[source]
class bw_graph_tools.graph_traversal.graph_objects.Node[source]

A visited activity in a supply chain graph. Although our graph is cyclic, we treat each activity as a separate node every time we visit it.

Parameters:
  • unique_id (int) – A unique integer id for this visit to this activity node

  • activity_datapackage_id (int) – The id that identifies this activity in the datapackage, and hence in the database

  • activity_index (int) – The technosphere matrix column index of this activity

  • reference_product_datapackage_id (int) – The id that identifies the reference product of this activity in the datapackage

  • reference_product_index (int) – The technosphere matrix row index of this activity’s reference product

  • reference_product_production_amount (float) – The net production amount of this activity’s reference product

  • depth (int) – Depth in the supply chain graph, starting from 0 as the functional unit

  • supply_amount (float) – The amount of the activity (not reference product!) needed to supply the demand from the requesting supply chain edge.

  • cumulative_score (float) – Total LCIA score attributed to supply_amount of this activity, including impacts from direct emissions.

  • direct_emissions_score (float) – Total LCIA score attributed only to the direct characterized biosphere flows of supply_amount of this activity.

  • direct_emissions_score_outside_specific_flows (float) – The score attributable to direct emissions of this node which isn’t broken out into separate Flow objects.

  • remaining_cumulative_score_outside_specific_flows (float) – The cumulative score of this node, including direct emissions, which isn’t broken out into separate Flow objects.

  • terminal (bool) – Boolean flag indicating whether graph traversal was cutoff at this node

activity_datapackage_id: int[source]
activity_index: int[source]
cumulative_score: float[source]
depth: int[source]
direct_emissions_score: float[source]
direct_emissions_score_outside_specific_flows: float = 0.0[source]
max_depth: int | None = None[source]
reference_product_datapackage_id: int[source]
reference_product_index: int[source]
reference_product_production_amount: float[source]
remaining_cumulative_score_outside_specific_flows: float = 0.0[source]
supply_amount: float[source]
terminal: bool = False[source]
unique_id: int[source]